home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / ndi201.zip / NDIS201.TXT < prev   
Text File  |  1991-01-08  |  220KB  |  5,224 lines

  1. Microsoft/3Com LAN Manager
  2. Network Driver Interface Specification
  3. Version 2.0.1
  4.  
  5.  
  6. Published 05 Oct., 1990
  7.  
  8. Copyright 1988, 1989, 1990 3Com Corporation/Microsoft Corporation
  9.  
  10.                  NOTICE
  11.  
  12.  
  13. This specification is intended for use by those developing or
  14. using networking products.  This specification may be copied
  15. freely for that purpose as long as copyright notice is preserved
  16. on all copies of the specification.  No fee or royalty is
  17. required by either 3Com Corporation or Microsoft Corporation to
  18. develop products which use the information contained within this
  19. specification.  Information contained in this specification may
  20. be included in documents, presentations, or products of third
  21. parties; however, authorship must be attributed jointly to 3Com
  22. Corporation and Microsoft Corporation, and appropriate copyright
  23. notices must be placed in any such documents or presentations.
  24. Additional copies of this specification may be obtained from 3Com
  25. Corporation or Microsoft Corporation.
  26.  
  27.  
  28. Table of Contents
  29.  
  30. Chapter 1 - Introduction
  31.  
  32. Definition of Terms                               1-1
  33. Scope of this Document                            1-2
  34. Changes for this Version                          1-2
  35.  
  36. Chapter 2 - Configuration and Binding
  37.  
  38. Configuration and Binding Process                 2-1
  39.  
  40. Chapter 3 - Protocol to MAC Interface Description
  41.  
  42. Transmission                                      3-1
  43. Reception                                         3-1
  44. Non Host-Buffered Adapter                         3-2
  45. Host-Buffered Adapter                             3-3
  46. Indication Control                                3-3
  47. Status Indication                                 3-3
  48. General Requests                                  3-4
  49. System Requests                                   3-5
  50. Protocol Manager Primitives                       3-5
  51.  
  52. Chapter 4 - Data Structures
  53.  
  54. Module Characteristics                            4-1
  55. Common Characteristics                            4-1
  56. MAC Service-Specific Characteristics              4-4
  57. MAC Service-Specific Status Table                 4-8
  58. MAC Upper Dispatch Table                          4-9
  59. Protocol Service-Specific Charateristics Table    4-10
  60. Protocol Lower Dispatch Table                     4-10
  61. Characteristics Table for NetBIOS Drivers         4-11
  62. Frame Data Description                            4-13
  63. Transmit Buffer Descriptor                        4-13
  64. Transfer Data Buffer Descriptor                   4-14
  65. Receive Chain Buffer Descriptor                   4-14
  66. PROTOCOL.INI                                      4-15
  67. Configuration Memory Image                        4-17
  68. ConfigMemoryImage                                 4-17
  69. ModuleConfig                                      4-17
  70. KeywordEntro                                      4-18
  71. Param                                             4-19
  72. Bindings List                                     4-20
  73.  
  74. Chapter 5 - Specification of Primitives
  75.  
  76. Direct Primitives                                 5-3
  77. TransmitChain                                     5-3
  78. TransmitConfirm                                   5-4
  79. ReceiveLookahead                                  5-5
  80. TransferData                                      5-6
  81. IndicationComplete                                5-7
  82. ReceiveChain                                      5-8
  83. ReceiveRelease                                    5-9
  84. IndicationOff                                     5-9
  85. IndicationOn                                      5-10
  86. General Requests                                  5-11
  87. Initiate Diagnostics                              5-11
  88. ReadErrorLog                                      5-12
  89. SetStationAddress                                 5-12
  90. OpenAdapter                                       5-13
  91. CloseAdapter                                      5-14
  92. ResetMAC                                          5-14
  93. SetPacketFilter                                   5-15
  94. AddMulticastAddress                               5-16
  95. DeleteMulticastAddress                            5-17
  96. UpdateStatistics                                  5-17
  97. ClearStatistics                                   5-18
  98. Interrupt                                         5-18
  99. SetFunctionalAddress                              5-19
  100. SetLookahead                                      5-19
  101. General Request Confirmation                      5-21
  102. StatusIndication                                  5-22
  103. RingStatus                                        5-22
  104. AdapterCheck                                      5-23
  105. StartReset                                        5-24
  106. EndReset                                          5-25
  107. Interrupt                                         5-25
  108. System Requests                                   5-26
  109. InitiateBind                                      5-26
  110. Bind                                              5-27
  111. InitiatePrebind (OS/2 only)                       5-27
  112. InitiateUnbind                                    5-28
  113. Unbind                                            5-29
  114. Protocol Manager Primitives                       5-30
  115. GetProtocolManagerInfo                            5-30
  116. RegisterModule                                    5-31
  117. BindAndStart                                      5-33
  118. GetProtocolManagerLinkage                         5-34
  119. GetProtocolIniPath                                5-35
  120. RegisterProtocolManagerInfo                       5-35
  121. InitAndRegister                                   5-36 
  122. UnbindAndStop                                     5-37
  123. BindStatus                                        5-38
  124. RegisterStatus                                    5-41
  125.  
  126. Chapter 6 - Protocol Manager
  127.  
  128. Protocol Manager Initialization                   6-1
  129. Static Binding Sequence                           6-1
  130. OS/2 CallingConvention                            6-3
  131. DOS Calling Convention                            6-4
  132.  
  133. Chapter 7 - VECTOR and Dynamic Binding
  134.  
  135. Static VECTOR Binding                             7-1
  136. Dynamic VECTOR Binding                            7-2
  137. Dynamic Binding/Unbinding in the DOS
  138. Environment                                       7-2
  139. Dynamic Binding/Unbinding in the OS/2
  140. Environment                                       7-3
  141. VECTOR Demultiplexing                             7-4
  142.  
  143. Appendix A:
  144. System Return Codes                               A-1
  145.  
  146. Appendix B:    
  147. Reference Material                                B-1
  148.  
  149. Appendix C:
  150. 802.3 Media Specific Statistics                   C-1
  151.  
  152. Appendix D:
  153. 802.5 Media Specific Statistics                   D-1
  154.  
  155. Appendix E:
  156. Utilities Provided with the Protocol Manager      E-1
  157.  
  158.  
  159.  
  160. Chapter 1:  Introduction
  161.  
  162. This document describes the LAN Manager network driver
  163. architecture and interfaces that let a DOS or OS/2 system support
  164. one or more network adapters and protocol stacks.  This
  165. architecture provides a standardized way for writing drivers for
  166. network adapters and communications protocols.  It also solves
  167. the problem of how to configure and bind multiple drivers into
  168. the desired set of layered protocol stacks.
  169.  
  170. Drivers written to the interfaces defined here will function
  171. concurrently in a system with other networking and protocol
  172. drivers, and will operate correctly with the LAN Manager software
  173. for DOS and OS/2.
  174.  
  175. Definition of Terms
  176.  
  177. To simplify the job of supporting multiple adapters and
  178. protocols, the architecture defines four kinds of drivers.
  179.  
  180. -    Media Access Control (MAC) drivers, which provide low-level
  181.      access to network adapters.  The main function of a MAC driver
  182.      is to support transmitting and receiving packets, plus some
  183.      basic adapter management functions.  MAC drivers are device
  184.      drivers that are loaded during system initialization and remain  
  185.      permanently in memory.  Since they cannot be unloaded, they are
  186.      called "static".
  187.  
  188. -    Protocol drivers, which provide higher-level communication
  189.      services from data link  to application (depending on the
  190.      driver).  An example is a NetBIOS driver that provides a
  191.      NetBIOS interface at the top and talks to a MAC driver at the
  192.      bottom.  Protocol drivers can be device drivers, TSRs, or
  193.      transient DOS applications.  A protocol driver is called
  194.      "static" if it cannot be unloaded.  A protocol driver is called  
  195.      "dynamic" if it can be loaded and unloaded on demand.
  196.  
  197. -    MAC-layer entities, which bind to real MAC drivers and
  198.      expose a new MAC-like layer interface on top.  Possible
  199.      examples are MAC bridges, test tools, or interface mappings
  200.      which change the NDIS interface to meet some environment-specific
  201.      administrative requirement.
  202.  
  203. -    The Protocol Manager driver.  This is a special driver that
  204.      provides a standardized way for multiple MAC and protocol
  205.      drivers to get configuration information and bind together
  206.      into the desired protocol hierarchy.  The Protocol Manager gets
  207.      all configuration information from a central file, PROTOCOL.INI.
  208.  
  209.  
  210. Scope of this Document
  211.  
  212. This document defines:
  213.  
  214. 1.   Protocol Manager functions and interfaces for configuration
  215.      and binding of MAC and protocol drivers.
  216.  
  217. 2.   The software interface between MAC and protocol drivers.
  218.  
  219. Separate documents will specify the configuration and interface
  220. details for other kinds of protocol drivers, including data link
  221. and transport drivers.
  222.  
  223. Changes for this Version
  224.  
  225. The major highlights of this version compared to the last (1.0)
  226. are:
  227.  
  228. 1.   Support for dynamic binding/unbinding of protocol modules,
  229.      allowing protocols to be swapped in and out of memory as
  230.      needed.  No changes are required of MAC drivers to support
  231.      the dynamic bind/unbind features.  In particular NDIS 1.0.1 
  232.      conformant MACs will support dynamically binding protocol
  233.      modules.
  234.  
  235. 2.   Additional Protocol Manager functions to support dynamic
  236.      binding and future administrative requirements.
  237.  
  238. 3.   Some adjustments to the Reset MAC function, StartReset, and EndReset
  239.      primitives were made to correct some inconsistencies and keep logic
  240.      out of the criticial paths.
  241.  
  242. 4.   Additional fields were added to certain tables to provide
  243.      additional information.  The presence or absence of these
  244.      fields can be determined by examining the length field in each
  245.      table.
  246.  
  247. 5.   Some new recommendations and clarifications on such issues
  248.      as double-word alignment of data blocks, the use of the
  249.      permanent station address, the copying of DS and entry points,
  250.      the use of 80386 32-bit registers, the release of internal re-
  251.      sources before confirmations, the handling of 0 length data
  252.      blocks, the formatting of MAC headers, the use of zero handles,
  253.      new transmit error codes for Token Ring to support source-
  254.      routing, and various other points that needed additional
  255.      clarifications.
  256.  
  257. 6.   A standard for protocol service-specific characteristics
  258.      tables.
  259.  
  260. 7.   The inclusion of additional 802.3 and 802.5 specific
  261.      information and added statistics definitions.
  262.  
  263. 8.   Additional information and caveats to help developers.
  264.  
  265. 9.   The Protocol Manager now has a transient component (in some
  266.      configurations)called PROTMAN.EXE.  This is now described
  267.      with certain restricitions imposed on Protocol Manager
  268.      primitives.
  269.  
  270. 10.  Some new error response codes were defined.
  271.  
  272. 11.  A new appendix, Appendix E, was added to describe some
  273.      helpful bind and configuration management utilities provided
  274.      with Protocol Manager.
  275.  
  276. 12.  Selected statistics designated as manditory for both 
  277.      service-specific and media specific statistics(802.3 and 802.5).
  278.  
  279. 13.  Extended 802.3 statistics to include Number_of_Underruns.
  280.  
  281. 14.  OpenAdapter function expanded to permit driver return of
  282.      vendor specified warning errors and/or hardware error codes. 
  283.  
  284. It is not expected that any of these changes will result in
  285. incompatibilities with protocol and MAC drivers written to
  286. previous versions of this specification.  Great care was taken to
  287. avoid creating incompatibilities.  It is the protocol's responsibility 
  288. to identify and interoperate with older NDIS version driver imple-
  289. mentations that may not have implemented support for statistics.
  290. Older network drivers will co-exist with network drivers written to
  291. this specification. However, to take advantage of new features
  292. (such as dynamic binding), developers may wish to update their protocol
  293. drivers tobe NDIS 2.0.1 compliant.
  294.  
  295.  
  296. Chapter 2:  Configuration and Binding
  297.  
  298. A network server or workstation includes at least one Media
  299. Access Control (MAC) and one protocol driver, plus the Protocol
  300. Manager driver.  More complex configurations may have multiple
  301. MAC and protocol drivers.
  302.  
  303. The Protocol Manager is always defined in CONFIG.SYS to load
  304. before any MAC or protocol drivers.  Its job is to read the
  305. configuration information out of the PROTOCOL.INI file and make
  306. this available to MAC and protocol drivers which load later.
  307.  
  308. MAC and protocol drivers use this information to set
  309. initialization parameters and allocate memory appropriately.  For
  310. example, a NetBIOS driver may use the configuration information
  311. provided by the Protocol Manager to determine its maximum number
  312. of names and sessions.
  313.  
  314. As each driver configures and initializes itself, it identifies
  315. itself to the Protocol Manager using a driver-defined "module
  316. name" and "characteristics table".  The module name defines a
  317. kind of logical name for the communication service provided by
  318. the driver.  The characteristics table provides specific
  319. parameters about the service and the set of entry points the
  320. driver uses to communicate with other drivers.  A single driver
  321. may identify itself to the Protocol Manager as multiple logical
  322. modules if, for example, it implements more than one layer of
  323. protocol interface (such as transport and data link).
  324.  
  325. Before two modules can communicate, they must be bound together.
  326. Binding is the process of two modules exchanging characteristics
  327. tables so that they can access each other's entry points.  This
  328. establishes the linkage they need to make requests of one another
  329. and indicate asynchronous request completion.  Binding is
  330. controlled by the Protocol Manager based on information from
  331. PROTOCOL.INI.  Binding can be either static or dynamic for
  332. protocol drivers.  If a protocol driver is static, then its
  333. binding is static.  If it is dynamic, then its binding is
  334. dynamic.  A dynamic protocol driver can be unbound from its bound
  335. drivers prior to unloading itself from memory.  This unbinding
  336. process is also controlled through the Protocol Manager.
  337.  
  338. Configuration and Binding Process
  339.  
  340. In the typical case of a system with one MAC driver and a NetBIOS
  341. driver, the set of drivers load and initialize as follows:
  342.  
  343. 1. Protocol Manager loads, initializes, and reads PROTOCOL.INI.
  344.  
  345. 2. MAC driver loads.  It calls GetProtocolManagerInfo to get any
  346.    needed configuration information, like its DMA channel.
  347.  
  348. 3. MAC driver initializes and calls RegisterModule to identify
  349.    itself as the module named e.g. "ETHERCARD."  This call passes
  350.    ETHERCARD's characteristics table to Protocol Manager.
  351.  
  352. 4. NetBIOS driver loads.  It calls GetProtocolManagerInfo to get
  353.    any needed configuration information, like the maximum number
  354.    of names, sessions, and commands to support.
  355.  
  356. 5. NetBIOS driver initializes and calls RegisterModule to
  357.    identify itself as the module named "NetBIOS".  This call
  358.    passes NetBIOS's characteristics table to Protocol Manager and
  359.    indicates that NetBIOS wants to bind to ETHERCARD.
  360.  
  361. 6. After all device drivers have loaded, Protocol Manager
  362.    determines from the information supplied on previous
  363.    RegisterModule requests that NetBIOS must bind to ETHERCARD.
  364.    Using a defined dispatch address in the characteristics table
  365.    for NetBIOS, Protocol Manager calls NetBIOS and instructs it
  366.    to bind to ETHERCARD.  The call, InitiateBind, includes the
  367.    characteristics table for ETHERCARD.
  368.  
  369. 7. NetBIOS calls ETHERCARD, requesting to Bind.  The modules
  370.    exchange characteristics tables with each other.  They now
  371.    have each other's entry points and are bound.
  372.  
  373. 8. NetBIOS may now call ETHERCARD at its defined entry points for
  374.    transmitting and receiving packets (see next section).
  375.  
  376. If the example NetBIOS driver was dynamically loadable, the
  377. binding to the ETHERCARD MAC would be done through the Protocol
  378. Manager's VECTOR facility (see Chapter 7).  The Vector shields
  379. the static MAC driver from the details of dynamic binding.
  380.  
  381.  
  382. Chapter 3:  Protocol to MAC Interface Description
  383.  
  384. The interface between a protocol and MAC driver provides for the
  385. transmission and reception of network packets, called frames.
  386. The interface includes other functions for controlling and
  387. determining the status of the network adapter controlled by the
  388. MAC.
  389.  
  390. To allow for efficient use of memory and to minimize buffer
  391. copies, frames being transmitted and received are passed between
  392. protocol and MAC using a scatter/gather buffer description
  393. convention.  This passes an array of pointers/lengths called a
  394. frame buffer descriptor.  There are three types of these
  395. descriptors, one for describing frames being transmitted
  396. (TxBufDescr) and two for frames being received (RxBufDescr and
  397. TDBufDescr).
  398.  
  399. Overall, the calls at the protocol/mac interface are grouped into
  400. categories of transmission, reception, indication control, status
  401. indications, and general requests.  An additional category of
  402. function, system requests, is generic to all drivers.
  403.  
  404.  
  405. Transmission
  406.  
  407. Transmitting data can work either synchronously or
  408. asynchronously, at the option of the MAC.  Protocols must be able
  409. to handle both cases.  Primitives are TransmitChain and
  410. TransmitConfirm.
  411.  
  412. Protocol                  MAC
  413.  
  414. Transmit Chain   -CALL->  Call passes TxBufDescr and unique handle.
  415.                           MAC may copy data now or later.
  416.  
  417.                <-RETURN-  Return indicates if data has been
  418.                           copied.  If not, MAC now owns frame
  419.                           data blocks and will copy them
  420.                           asynchronously.
  421.  
  422. Later on, after data is copied by MAC:
  423.  
  424. TransmitConfirm  <-CALL-  Call supplies unique handle from Transmit.
  425.  
  426.                 -RETURN-> Data block ownership returned to protocol.
  427.  
  428.  
  429. NOTE:  If the MAC transmits the frame synchronously, it indicates
  430. this on the return from TransmitChain and will not generate a
  431. TransmitConfirm.
  432.  
  433. Reception
  434.  
  435. Receiving data can work in either of two ways, depending on the
  436. MAC.  Protocols must be able to handle both cases.
  437.  
  438. -   The MAC generates a ReceiveLookahead indication that points to
  439.     part or all of the received frame in contiguous storage.  This
  440.     is called the "lookahead" data.  The protocol may issue a
  441.     TransferData call back to the MAC if it wants the MAC to copy all
  442.     or part of the received frame to protocol storage.  The protocol
  443.     may, of course, copy the look ahead data itself.  In some imple-
  444.     mentations, this may be the entire frame.
  445.  
  446. -   The MAC generates a ReceiveChain indication that points to a
  447.     RxBufDescr that describes the entire frame received.  The
  448.     protocol may copy the data immediately or later.  If later, it
  449.     releases the frame buffer areas back to the MAC via a call to
  450.     ReceiveRelease.
  451.  
  452. Generally, the first approach will be implemented by MAC drivers
  453. for non-host buffered network adapters, while drivers for host
  454. buffered network adapters will implement the second.  Non-host
  455. buffered adapters that use programmed I/O or DMA will generally
  456. provide a small leading portion of the received frame as look
  457. ahead data, whereas those using a single memory mapped buffer
  458. will usually provide the whole frame.
  459.  
  460. In either case, the protocol must validate the received packet
  461. very rapidly (within a few instructions) and to reject it if
  462. necessary.  This is very important to performance in a multi-
  463. protocol environment.
  464.  
  465. The following sections illustrate the non host-buffered adapter
  466. versus host-buffered adapter receive scenarios:
  467.  
  468. Non Host-Buffered Adapter
  469.  
  470. MAC                            Protocol
  471.  
  472. ReceiveLookahead    -CALL->    Call passes pointer to lookahead data.
  473.                                Protocol examines this data.
  474.   
  475. If protocol wants the frame and look ahead wasn't the whole
  476. frame, the protocol can ask MAC to transfer the frame:
  477.  
  478. TransferData        <-CALL-    Passes TDBufDescr indicating where to put
  479.                                the received data.
  480.  
  481.                     -RETURN->
  482.  
  483.                     <-RETURN- 
  484.       
  485. Upon return from protocol, MAC re-enables the hardware.
  486.  
  487. IndicationComplete  -CALL->    MAC calls protocol to allow interuppt-time
  488.                                post processing.
  489.  
  490.                     <-RETURN-
  491.  
  492. Host-Buffered Adapter
  493.  
  494. MAC                            Protocol
  495.  
  496. ReceiveChain        -CALL->    Call passes pointer to RxDataDescr.
  497.  
  498.                     <-RETURN-  Return tells if protocol accepts
  499.                                the frame, and if so, whether it
  500.                                copied the data.  If accepted but
  501.                                not copied, ownership of data
  502.                                blocks passes to the protocol which
  503.                                copies the data asynchronously.
  504.  
  505. IndicationComplete  -CALL->    MAC calls protocol to allow
  506.                                interrupt-time post processing.
  507.  
  508.                     <-RETURN-
  509.  
  510. Later, if protocol deferred copying the data (this may occur during 
  511. IndicationComplete)
  512.  
  513.                <-CALL-    ReceiveRelease.  The call supplies
  514.                           the unique handle from ReceiveChain.
  515.  
  516.                -RETURN->  Data block ownership returned to MAC.
  517.  
  518.  
  519. Indication Control
  520.  
  521. Two primitives let a protocol selectively control when it can be
  522. called with indications from the MAC.  These are IndicationOn and
  523. IndicationOff.
  524.  
  525. Before calling an indication routine, the MAC implicitly disables
  526. indications.  This means, for example, that if another frame
  527. arrives while the protocol is processing the indication for the
  528. previous one, the protocol will not be reentered.  Likewise, if
  529. the protocol issues a TransmitChain for loopback data from within
  530. the ReceiveLookahead indication routine, it will not be reentered
  531. to process the loopback data reception.
  532.  
  533. Protocols can re-enable indications upon returning from
  534. ReceiveLookahead, ReceiveChain or Status indications or by
  535. calling IndicationOn within the IndicationComplete routine.
  536.  
  537. Status Indication
  538.  
  539. Status indications are calls from a MAC to protocol that convey a
  540. change in adapter or network status.
  541.  
  542. A status indication works much like a reception indication.  The
  543. status indication handler is entered with indications disabled
  544. and there is a mechanism which will leave indications disabled.
  545.  
  546. MAC                            Protocol
  547.  
  548. Status              -CALL->    Call passes status type and
  549.                                information.
  550.  
  551.                     <-RETURN-
  552.  
  553.  
  554. IndicationComplete  -CALL->    MAC calls protocol to allow
  555.                                interrupt-time post processing.
  556.  
  557.                     <-RETURN-
  558.  
  559.  
  560. General Requests
  561.  
  562. General requests are calls from a protocol to a MAC, asking it to
  563. do a general function such as open or close the network adapter
  564. or change the station address.
  565.  
  566. General requests work much like a TransmitChain request, except
  567. the primitives are Request and RequestConfirm.
  568.  
  569. Protocol                       MAC
  570.  
  571. Request             -CALL->    Issue request to MAC with unique
  572.                                handle.
  573.  
  574.                     <-RETURN-  Return indicates if request completed.
  575.  
  576. Later, if request completed asynchronously:
  577.  
  578.                <-CALL-    RequestConfirm.  The call supplies
  579.                           unique handle from Request.
  580.  
  581.                -RETURN->
  582.  
  583. If the MAC satisfies the request synchronously, it indicates this
  584. on the return from Request and will not generate a RequestConfirm.
  585.  
  586.  
  587. System Requests
  588.  
  589. System requests support module binding and management functions.
  590. They are usually made by the Protocol Manager to a MAC or
  591. protocol module, but can also be made by a protocol to another
  592. protocol or MAC module.
  593.  
  594. System requests work much like general requests except that all
  595. are synchronous and the requests are not module specific.
  596.  
  597. Upper Module                   Lower Module
  598.  
  599. System              -CALL->    Issue request to lower module.
  600.  
  601.                     <-RETURN-  Return indicates request completed.
  602.  
  603.  
  604. Protocol Manager Primitives
  605.  
  606. Protocol Manager primitives are requests from protocol or MAC modules
  607. to the Protocol Manager for various Protocol Manager services.  These 
  608. requests are always synchronous.
  609.  
  610. Protocol or MAC                        Protocol Manager
  611. Module
  612. Primitive            -CALL->    Issue request to Protocol Manager
  613.  
  614.                      <-RETURN-  Return indicates request completed
  615.  
  616.  
  617. Chapter 4:  Data Structures
  618.  
  619.  
  620. Module Characteristics
  621.  
  622. Protocol and Media Access Control (MAC) modules are described by
  623. a data structure called a characteristics table.  Each
  624. characteristics table consists of several sections:  a master
  625. section called the common characteristics table and four
  626. subtables.  The common characteristics table contains module-
  627. independent information, including a dispatch address for issuing
  628. system commands like InitiateBind to the module.  The four
  629. module-specific subtables are chained off the common
  630. characteristics table.  These define module-specific parameters
  631. and the entry points used for inter-module communication (such as
  632. the MAC/protocol interface functions).  When two modules bind
  633. together, they exchange pointers to their common characteristics
  634. tables, so that each gets access to the other's descriptive
  635. information and entry points.
  636.  
  637. NOTE: NDIS drivers must copy the Module DS and entry point
  638. addresses (from the Common Characteristics and Upper/Lower
  639. Dispatch Tables) to their local data segment at Bind time.  In
  640. future versions of this specification, this information may be
  641. volatile.  Having this information directly accessible will also
  642. improve performance.  This information must not be copied prior
  643. to the Bind call and must not be used unless the Bind completes
  644. successfully.
  645.  
  646. NOTE: The information in the characteristics table for a module
  647. is primarily informational, in support of network management and
  648. configuration tools.  Upper modules binding to lower ones will
  649. NOT need to parse this information to adapt their behavior at the
  650. interface.  They will generally just use the information to
  651. validate that they have been bound to the correct type of module.
  652. Most of the other information is provided in the structure to
  653. support information utilities.
  654.  
  655. Some new fields have been added to some of the characteristics
  656. tables for V2.0.1.  The size/length fields at the start of the
  657. tables can be checked to see if the new fields are available in
  658. the table.
  659.  
  660. Common Characteristics
  661.  
  662. The format of this information is identical for all modules.
  663. Note that all information in this section of the table is static.
  664.  
  665. WORD      Size of common characteristics table (bytes)
  666. BYTE      Major NDIS Version (2 BCD digits - 02 for this version)
  667. BYTE      Minor NDIS Version (2 BCD digits - 00 for this version)
  668. WORD      Reserved
  669. BYTE      Major Module Version (2 BCD digits)
  670. BYTE      Minor Module Version (2 BCD digits)
  671. DWORD     Module function flags, a bit mask :
  672.            0 - Binding at upper boundary supported
  673.         1 - Binding at lower boundary supported
  674.         2 - Dynamically bound (i.e., this module can be swapped out)
  675.         3-31 - Reserved, must be zero
  676. BYTE[16]  Module name - ASCIIZ format
  677. BYTE      Protocol level at upper boundary of module:
  678.         1 - MAC
  679.         2 - Data link
  680.         3 - Network
  681.         4 - Transport
  682.         5 - Session
  683.         -1 - Not specified
  684. BYTE      Type of interface at upper boundary of module:
  685.         For MAC's:       1 => MAC
  686.            For Data Links:  To be defined
  687.         For Transports:  To be defined
  688.         For Session:     1 => NCB
  689.         For any level:   0 => private (ISV defined)
  690. BYTE      Protocol level at lower boundary of module
  691.         0 - Physical
  692.         1 - MAC
  693.         2 - Data link
  694.         3 - Network
  695.         4 - Transport
  696.         5 - Session
  697.         -1 - Not specified
  698. BYTE      Type of interface at lower boundary of module:
  699.         For MAC:          1 => MAC
  700.         For Data Link:    To be defined
  701.         For Transport:    To be defined
  702.         For Session:      1 => NCB
  703.         For any level:    0 => private (ISV defined)
  704. WORD      Module ID filled in by Protocol Manager on return from
  705.           RegisterModule
  706. WORD      Module DS
  707. LPFUN     System request dispatch entry point
  708. LPBUF     Pointer to service-specific characteristics (NULL if none)
  709. LPBUF     Pointer to service-specific status (NULL if none)
  710. LPBUF     Pointer to upper dispatch table (see below; NULL if none)
  711. LPBUF     Pointer to lower dispatch table (see below; NULL if none)
  712. LPBUF     Reserved for future expansion, must be NULL
  713. LPBUF     Reserved for future expansion, must be NULL
  714.  
  715. NOTE:    LPSZ   Long pointer to an ASCIIZ string
  716.          LPBUF  Long pointer to a data buffer
  717.          LPFUN  Long pointer to a function
  718.  
  719. In V1.0.1, the 2 bytes after the first WORD were required to be
  720. set to 0.  For compatibility with V1.0.1, an NDIS spec major
  721. version number of 00 is interpreted the same as major version
  722. number 01.
  723.  
  724. The module function flags bit mask must accurately specify the
  725. capabilities of the module.  The Protocol Manager uses these
  726. fields; e.g. the "Dynamically bound" (bit 2) flag when set
  727. indicates that this module is a dynamically loadable and
  728. unloadable module.  Such a module can only be used in the
  729. Protocol Manager dynamic mode.
  730.  
  731. The upper and lower boundary protocol level and interface type
  732. bytes must accurately specify the protocol level and interface
  733. type.  The Protocol Manager uses these fields.  If an interface
  734. does not support NDIS bindings or a protocol level is undefined
  735. at the interface, a value at OxFF must be used.  In this case the
  736. corresponding interface type is undefined.
  737.  
  738. In addition to the above common characteristics table, a given
  739. module will typically have a set of sub-tables that are chained
  740. off the common table:
  741.  
  742. -  Service-specific characteristics table:
  743.    This table contains descriptive information and parameters
  744.    about the module.
  745.  
  746. -  Service-specific status table:
  747.    This table contains runtime operating status and statistics for
  748.    the module.
  749.  
  750. -  Upper dispatch table:
  751.    This table contains dispatch addresses for the upper boundary
  752.    of the module - i.e., the entry points it exports as a service
  753.    provider.
  754.  
  755. -  Lower dispatch table:
  756.    This table contains dispatch addresses for the lower
  757.    boundary of the module - i.e., the entry points it exports
  758.    as a service client.
  759.  
  760. NOTE:  Under OS/2 dispatch addresses and data segments are Ring 0
  761. selectors.  This field is usually set at Ring 3 INIT time even
  762. though the selector set must be Ring 0.
  763.  
  764.  
  765. MAC Service-Specific Characteristics
  766.  
  767. All MAC's use the following format for this table.  This table
  768. contains volatile information (like the current station address)
  769. which may be updated by the MAC during the course of operation.
  770. Other modules may read this table directly during execution.
  771.  
  772. WORD        Length of MAC service-specific characteristics table
  773. BYTE [16]   Type name of MAC, ASCIIZ format:
  774.                802.3, 802.4, 802.5, 802.6, DIX, DIX+802.3, APPLETALK,
  775.                ARCNET, FDDI, SDLC, BSC, HDLC, ISDN
  776. WORD        Length of station addresses in bytes
  777. BYTE [16]   Permanent station address
  778. BYTE [16]   Current station address
  779. DWORD       Current functional address of adapter (0 if none)
  780. LPBUF       Multicast Address List (structure defined below)
  781. DWORD       Link speed (bits/sec)
  782. DWORD       Service flags, a bit mask:
  783.               0 - broadcast supported
  784.            1 - multicast supported
  785.            2 - functional/group addressing supported
  786.            3 - promiscuous mode supported
  787.            4 - software settable station address
  788.            5 - statistics are always current in service-specific
  789.                    status table
  790.            6 - InitiateDiagnostics supported
  791.            7 - Loopback supported
  792.            8 - Type of receives
  793.                0 - MAC does primarily ReceiveLookahead indications
  794.                1 - MAC does primarily ReceiveChain indications
  795.            9 - IBM Source routing supported
  796.           10 - Reset MAC supported
  797.           11 - Open / Close Adapter supported
  798.           12 - Interrupt Request supported
  799.           13 - Source Routing Bridge supported
  800.           14 - GDT virtual addresses supported
  801.           15 - Multiple TransferDatas permitted during a single
  802.                    indication (V2.0.1 and later)
  803.           16 - Mac normally sets FrameSize = 0 in ReceiveLookahead
  804.                    (V2.0.1 and later)
  805.           17-31 - Reserved, must be 0
  806. WORD        Maximum frame size which may be both sent and received
  807. DWORD       Total transmission buffer capacity in the driver (bytes)
  808. WORD        Transmission buffer allocation block size (bytes)
  809. DWORD       Total reception buffer capacity in the driver (bytes)
  810. WORD        Reception buffer allocation block size (bytes)
  811. CHAR[3]     IEEE Vendor code
  812. CHAR        Vendor Adapter code
  813. LPSZ        Vendor Adapter description
  814. WORD        IRQ Interrupt level used by adapter (V2.0.1 and later)
  815. WORD        Transmit Queue Depth (V2.0.1 and later)
  816. WORD        Maximum number of data blocks in buffer descriptors
  817.             supported (V2.0.1 and later)
  818.  
  819. Remaining bytes in table (based on Length) are vendor-specific
  820.  
  821. In interpreting these tables the implementer must always bear in
  822. mind that additional functions may be added to future MAC's and
  823. that the support of functions that the protocol does not need
  824. must not prevent the protocol from accepting a bind for the MAC.
  825.  
  826. The type name describes to the protocol the type of MAC protocol
  827. header that the MAC driver supports.  In general, protocol stacks
  828. must be prepared to support the types "802.3", "802.5", "DIX" and
  829. "DIX+802.3".  If the native media of the MAC is not one of these
  830. types (for example, ARCNET) then it is recommended that the MAC
  831. developer must consider claiming support for one of the above
  832. types and doing a transparent internal mapping between the
  833. private header format of the media and the public header format
  834. being claimed.  Without support for one of the above header
  835. formats, general protocol compatibility cannot be guaranteed.
  836. The list specified above is not exhaustive.  New names may be
  837. added in the future or a vendor may provide special MAC type
  838. names for use with protocols that interoperate with special MACs
  839. provided by that vendor.  In the latter case it is recommended
  840. that a vendor use a MAC type name that does not start with an
  841. alphanumeric character to avoid conflicts with NDIS MAC type
  842. names that might be specified in future versions of this
  843. specification.
  844.  
  845. The normal type name of an ethernet MAC would be "DIX+802.3."
  846. See Appendix B for references on IEEE 802.3 and DIX.
  847.  
  848. In the various parts of this specification, all station and
  849. multicast addresses for a given MAC have the length specified in
  850. the "Length of Station Address" field.
  851.  
  852. The permanent station address must be obtained from the hardware
  853. if at all possible, as it may be used by LAN Manager for security
  854. or administrative purposes.  If a PROTOCOL.INI entry is used to
  855. override the current station address, the permanent station
  856. address must not be affected.  Only if there is no hardware based
  857. addressing scheme will it be possible to override the permanent
  858. station address by configuration parameters.  The current station
  859. address will always reflect the current address as set via
  860. parameter or by calling Request SetSetationAddress.
  861.  
  862. The functional address DWORD represents the functional address
  863. bit pattern present in the last 4 bytes of an IBM compatible
  864. functional address.  This excludes the first 2 bytes 0xC0, 0x00.
  865. The functional address DWORD represents the logical OR of all
  866. functional addressess currently registered to the adapters.
  867.  
  868. Multicast Address List is a buffer formatted as follows:
  869.  
  870. WORD      Maximum number of multicast addresses
  871. WORD      Current number of multicast addresses
  872. BYTE[16]  Multicast address 1
  873. BYTE[16]  Multicast address 2
  874.      . . .
  875. BYTE[16]  Multicast Address N
  876.  
  877. The Multicast Address List is kept packed by the MAC so that the
  878. current multicast addresses occur first in the list.
  879.  
  880. Service flags indicate which optional functions are supported by
  881. an NDIS driver. If a particular function bit is set, that
  882. function is supported.  When attempts are made to invoke
  883. unsupported functions, NDIS MAC drivers must respond properly by
  884. returning INVALID_FUNCTION (0x0008).
  885.  
  886. If loopback is supported in the network adapter hardware, then
  887. bit 7 of the MAC service flags must be set.
  888.  
  889. If loopback is not supported in hardware (bit 7 of the MAC
  890. service flags is not set), the protocol driver must handle this
  891. function itself by some loopback delivery of the frame to be
  892. transmitted.
  893.  
  894. The following criteria must be met for loopback:
  895.  
  896.      1.   The destination address is the same as the local
  897.           station's current station address or the destination is
  898.           a broadcast, multicast or functional address which
  899.           would have been received by this station if sent by another.
  900.  
  901.      2.   The frame must qualify for reception according to the
  902.           current packet filter.
  903.  
  904. The loopback mechanism must cause the Receive indication to occur
  905. at interrupt time (and it must be delayed by IndicationOff)
  906.  
  907. If IBM source routing is used (bit 9 is set) it is the protocol
  908. module's responsibility to encode and interpret appropriate
  909. source routing information.  This bit merely implies that the
  910. device is capable of sending packets with the "source routing
  911. bit" set in the source address so that a protocol may recognize
  912. such a packet.
  913.  
  914. While the ResetMAC function (bit 10) is optional, it is strongly
  915. recommended that those implementing the NDIS MAC driver support
  916. this function.  Some protocol drivers may rely on this function
  917. to recover from hardware error conditions.
  918.  
  919. If the service flags indicate that OpenAdapter is supported (bit
  920. 11 is set), then the protocol driver must ensure that the adapter
  921. is open.  The open status of an adapter can be determined by
  922. examining bit 4 of the MAC status in the MAC service-specific
  923. status table.  If the adapter is not open, then the protocol must
  924. issue an OpenAdapter Request (normally during bind-time
  925. processing).
  926.  
  927. If Source Routing Bridge is set (bit 13) then it is implied that
  928. the MAC is capable of receiving all packets on the network which
  929. have the source routing bit set.
  930.  
  931. If GDT virtual addresses are supported (bit 14 is set) then Ring
  932. 0 GDT virtual addresses may be used to describe frames.  All
  933. MAC's must support the use of physical addresses to describe
  934. frames; however, for some MAC's it is preferable to supply a GDT
  935. address if one is readily available.  The GDT address must remain
  936. valid throughout the scope of its use by the MAC.
  937.  
  938. If bit 16 of the service flags field is set, then the MAC driver
  939. does not normally provide the total frame size of received data.
  940. In this case the MAC normally calls RecieveLookahead with the
  941. FrameSize parameter equal to 0.  Setting this bit is optional.
  942. It is left to the MAC implementor to determine how frequently
  943. returning FrameSize equals 0 constitutes sufficient grounds to
  944. set this bit.  However, this bit must be reset if the MAC always
  945. calls ReceiveLookahead with the FrameSize parameter non-zero or
  946. if a 0 FrameSize parameter is returned only for intermittent
  947. erroneous packet reception.  For V1.0.1 compatibility, bit 16
  948. reset gives no indication whether the MAC will return a zero
  949. FrameSize parameter or not.  Some MAC and higher layer protocols
  950. do not support "length" fields within their encoding.  Such
  951. protocols rely on knowing the size of valid frame data received
  952. at the MAC interface and then deduce the amount of data at their
  953. layer by stripping off the lower layer protocol headers.  This
  954. bit warns such protocols that the required received frame size is
  955. not normally available at the MAC interface and that receive
  956. frames might not be able to be processed.  Such protocols can
  957. refuse to bind to such MACs.
  958.  
  959. The maximum frame size must reflect the maximum size packet that
  960. can be both transmitted and received by the MAC client.  This
  961. size must reflect only the bytes which actually cross the NDIS
  962. boundary.  For Ethernet, this value is typically 1514, since the
  963. client does not specify the CRC bytes.  Token Ring values vary
  964. but do not include the non-data SD, ED and FS bytes or the FCS.
  965.  
  966. The network adapter RAM is characterized by four parameters.  The
  967. first is the number of bytes available for storing packets to be
  968. transmitted, usually one or two full-size packets in size.  The
  969. second parameter is the allocation granularity, typically about
  970. 256 bytes, indicating how much memory would be occupied by a one
  971. byte packet pending transmission.  The next two parameters are
  972. the number of bytes available for storing received packets and
  973. the receive packet granularity.  Often these parameters will be
  974. affected by PROTOCOL.INI keywords (for example, specifying two
  975. transmit buffers rather than one), and it is required that these
  976. numbers accurately reflect the current adapter configuration.
  977. Protocol drivers may use these numbers to determine reasonable
  978. window sizes, and incorrect values may impact performance.
  979.  
  980. The intent of the IEEE Vendor and Vendor Adapter Codes is that,
  981. when used in combination, they uniquely identify this MAC driver
  982. for this adapter.  The IEEE Vendor Code uniquely defines the
  983. vendor providing the MAC driver.  The use of the IEEE Vendor Code
  984. avoids the need for any global registry of Vendor Adapter Codes.
  985. The IEEE Vendor Code is assigned by the IEEE and becomes the
  986. first three bytes of a six-byte IEEE 802 address.  The Vendor
  987. Adapter Code specifies a particular MAC driver provided by the
  988. Vendor for an adapter.  If the IEEE Vendor Code is assigned to
  989. the Vendor, the Vendor assigns a unique Vendor Adapter Code to
  990. each MAC driver provided.  For those without an IEEE Vendor Code,
  991. a value of 0xFFFFFF is required.  In this case, the Vendor
  992. Adapter Code is undefined.
  993.  
  994. The Vendor Adapter description string is an ASCIIZ string
  995. containing a description of the adapter that could be used to
  996. format an error message (for example, "3Com EtherLink II
  997. Adapter").
  998.  
  999. The transmit queue depth specifies the maximum number of
  1000. TransmitChain requests the MAC can buffer internally.  This
  1001. number must be set to one if the TransmitChain implementation in
  1002. the MAC is synchronous.  Each queued TransmitChain request
  1003. requires that the MAC driver copy at least the chain descriptor
  1004. and immediate data, so this parameter is generally configurable
  1005. through a PROTOCOL.INI keyword called MAXTRANSMITS.  The protocol
  1006. driver can use this queue depth to compute the amount of time a
  1007. transmit might be queued up within the MAC.
  1008.  
  1009. The maximum number of data buffer blocks is the maximum number of
  1010. blocks supported in Transmit, TransferData, and ReceiveChain
  1011. buffer desciptors.  For V1.0.1 backward compatibility this must
  1012. be a minimum of 8.  For V1.0.1 compatible MACs for which this
  1013. field is absent, the maximum number assumed is 8.
  1014.  
  1015. The size of the NDIS defined part of the MAC specific
  1016. characteristics table may increase in subsequent versions of the
  1017. specification.  If vendor specific information follows the NDIS
  1018. defined information, a protocol using it must check the NDIS spec
  1019. version number in the Common Characteristics table to determine
  1020. where the NDIS specified information ends and the vendor
  1021. specified information begins.
  1022.  
  1023. MAC Service-Specific Status Table
  1024.  
  1025. The MAC service-specific status and media-specific statistics
  1026. tables provide information about the status of and traffic
  1027. through a MAC.  Since these tables can be updated by the MAC
  1028. driver at interrupt time, a protocol must ensure that these
  1029. tables are read with interrupts disabled.  The MAC must update
  1030. this table (and the media-specific statistics table if present)
  1031. atomically.
  1032.  
  1033. WORD     Length of status table
  1034. DWORD    Date/time when diagnostics last run (0xFFFFFFFF if not run).
  1035.          Format is seconds since 12:00 Midnight January 1, 1970
  1036. DWORD    MAC status, a 32-bit mask:
  1037.            0-2 - Opcoded as follows:
  1038.            0 - Hardware not installed
  1039.            1 - Hardware failed startup diagnostics
  1040.            2 - Hardware failed due to configuration problem
  1041.            3 - Hardware not operational due to hardware fault
  1042.            4 - Hardware operating marginally due to soft faults
  1043.            5-6 Reserved
  1044.            7 - Hardware fully operational
  1045.            3 - If set, MAC is bound, else not bound
  1046.            4 - If set, MAC is open, else not open (if adapter
  1047.                doesn't support open/close function, set to 1 if
  1048.                hardware is functional)
  1049.            5 - If set, adapter diagnostics are in progress (V2.0.1
  1050.                and later)
  1051.            6-31 - Reserved, must be zero 
  1052. WORD  Current packet filter, a bit mask:
  1053.            0 - directed and multicast or group and functional
  1054.            1 - broadcast
  1055.            2 - promiscuous
  1056.            3 - all source routing
  1057.            4-15 - Reserved, must be zero
  1058.  
  1059. Statistics for MAC's 
  1060.        Statistics in bold are mandatory, all others are strongly recommended,
  1061.        0xFFFFFFFF means not supported.
  1062.        Reserved slots should return as 0xFFFFFFFF (unsupportd).
  1063.  
  1064. LPBUF   Pointer to media specific statistics table (may be NULL)
  1065. DWORD   Date/time when last ClearStatistics issued (0xFFFFFFFF
  1066.         if not kept) format is seconds since 12:00 Midnight
  1067.         January 1, 1970
  1068. DWORD   Total frames received OK
  1069. DWORD   Total frames with CRC error
  1070. DWORD   Total bytes received
  1071. DWORD   Total frames discarded - no buffer space
  1072. DWORD   Total multicast frames received OK
  1073. DWORD   Total broadcast frames received OK
  1074. DWORD   Reserved (Obsolete statistic)
  1075. DWORD   Reserved (Obsolete statistic)
  1076. DWORD   Reserved (Obsolete statistic)
  1077. DWORD   Reserved (Obsolete statistic)
  1078. DWORD   Reserved (Obsolete statistic)
  1079. DWORD   Total frames discarded - hardware error
  1080. DWORD   Total frames transmitted OK
  1081. DWORD   Total bytes transmitted OK
  1082. DWORD   Total multicast frames transmitted
  1083. DWORD   Total broadcast frames transmitted
  1084. DWORD   Reserved (Obsolete statistic)
  1085. DWORD   Reserved (Obsolete statistic)
  1086. DWORD   Total frames not transmitted - time-out
  1087. DWORD   Total Frames not transmitted - hardware error
  1088.  
  1089. Remaining bytes (based on Length) in table are vendor specific.
  1090.  
  1091. All statistics counters are 32-bit unsigned integers that wrap to
  1092. zero when the maximum count is reached after which the counters
  1093. will continue to count.  When updating these counters, a frame is
  1094. counted in all the supported counters that apply.  The case of an
  1095. unsupported counter (0xFFFFFFFF) can be distinguished from the
  1096. situation wherby a counter is about the wrap around if the values
  1097. of the counters are checked at bind times.  If the initial value
  1098. of the counter is 0xFFFFFFFF, then the counter is not supported.
  1099. Otherwise the counter is supported and 0xFFFFFFFF at a later time
  1100. means the counter is about to wrap around.
  1101.  
  1102. SERVICE SPECIFIC STATISTICS DEFINITIONS:
  1103.  
  1104. Total frames received ok
  1105. (NumberOfFramesReceivedOK) - corresponding 802.3 statistics
  1106.  
  1107.      This contains a count of frames that are successfully received.
  1108.      It does not include "frames with errors", as listed in non-media
  1109.      specific statistics item 7.
  1110.  
  1111. Frames received with CRC error
  1112.      This contains a count of frames that are an integral number of 
  1113.      bytes in length and do not pass the FCS check. Reports on CRC
  1114.      errors "as the station sees it".
  1115.  
  1116. Total bytes received ok
  1117.      This contains a count of bytes in frames that are successfully 
  1118.      received. It includes bytes from received multicast and broadcast
  1119.      frames. This number should include everything, starting from
  1120.      destination address up to but excluding FCS. Source address
  1121.      destination address, length (or type) and pad are included. It
  1122.      should exclude FCS and the preambles.
  1123.    
  1124.      According to this definition, this NDIS statistics is not exactly
  1125.      the same as 802.3's NumberOfBytesReceivedOK, which does not include 
  1126.      the octets in the address and length/type fields.
  1127.  
  1128. Frames discarded - no buffer space
  1129.      
  1130.      Frames discarded by MAC driver due to a lack of buffer space.
  1131.  
  1132. Multicast frames received ok.
  1133.      (NumberOfMulticastFramesReceivedOK)
  1134.  
  1135.      This includes all of the multicast frames the MAC driver received
  1136.      successfully.
  1137.  
  1138.      It does not include "frames with errors" as listed in non-media
  1139.      specific statistics item 7.
  1140.  
  1141. Broadcast frames received ok.
  1142. (NumberOfBroadcastFramesReceivedOK)
  1143.  
  1144.      This includes all of the broadcast frames the MAC driver receives
  1145.      successfully.
  1146.   
  1147.      It does not include "frames with errors" as listed in non-media 
  1148.      specific statistics item 7.
  1149.  
  1150. Frames discarded - hardware error
  1151.  
  1152.      Frames discarded due to hardware error.
  1153.      Definition of this statistic should be adapter spacific.
  1154.  
  1155. Total frames transmitted ok.
  1156. (NumberOfFramesTransmittedOK)
  1157.  
  1158.      Total number of frames transmitted successfully.
  1159.  
  1160. Total bytes transmitted ok.
  1161.   
  1162.      Total number of bytes transmitted successfully.
  1163.  
  1164.      This number should include everything, starting from destination
  1165.      address up to but excluding FCS. Source address destination  
  1166.      address, length (or type) and pad are included. It should exclude
  1167.      FCS and the preambles.
  1168.  
  1169. Multicast frames transmitted ok.
  1170. (NumberOfMulticastFramesTransmittedOK)
  1171.  
  1172.      Number of frames transmitted successfully to non-broadcast group
  1173.      address.
  1174.  
  1175. Broadcast frames transmitted ok.
  1176. (NumberOfBroadcastFramesTransmittedOK)
  1177.  
  1178.      Number of frames transmitted successfully to broadcast address.
  1179.  
  1180. Frames not transmitted - time-out
  1181.  
  1182.      This contains a count of frames that could not be transmitted
  1183.      due to the hardware not signaling transmission completion 
  1184.      for an excessive period of time.
  1185.  
  1186. Frames not transmitted - hardware error
  1187.  
  1188.      This contains a count of frames that could not be transmitted 
  1189.      due to a hardware error. This count should exclude DMA underrun
  1190.      error which itself is a separate counter (Frames transmitted 
  1191.      with underun). Definition of this statistic should be adapter specific.
  1192.  
  1193. MAC Upper Dispatch Table
  1194.  
  1195. The number and meaning of dispatch addresses provided here apply
  1196. to the boundary between a MAC and a protocol.  This may differ at
  1197. other protocol boundaries.  Note that each upper/lower module
  1198. binding may have its own unique set of dispatch addresses that is
  1199. set up when the modules exchange characteristics tables.  This
  1200. can be achieved by exchanging copies of the common
  1201. characteristics table, where the copy has the desired pointers to
  1202. the specific dispatch tables for the binding.
  1203.  
  1204. LPBUF  Back pointer to common characteristics table
  1205. LPFUN  Request address
  1206. LPFUN  TransmitChain address
  1207. LPFUN  TransferData address
  1208. LPFUN  ReceiveRelease address
  1209. LPFUN  IndicationOn address
  1210. LPFUN  IndicationOff address
  1211.  
  1212. NOTE: No dispatch address is allowed to be NULL.
  1213.  
  1214. Protocol Service-Specific Characteristic Table
  1215.  
  1216. For compatibility with future versions of this specification, all
  1217. protocols must provide a protocol service-specific
  1218. characteristics table which starts with the following fields:
  1219.  
  1220. WORD        Length of protocol service-specific characteristics table
  1221. BYTE [16]   Type name of protocol, ASCIIZ format:
  1222. WORD        Protocol type code
  1223.  
  1224. This may be followed by protocol-specific information.
  1225.  
  1226. The protocol type name will be used in future versions of this
  1227. specification.  Specific type names for different protocol types
  1228. will be defined later.  Protocol type codes will also be defined
  1229. later.  For the moment these two fields are simple place holders
  1230. and must be set to null string and zero respectively.
  1231.  
  1232. Protocol Lower Dispatch Table
  1233.  
  1234. The protocol lower dispatch table is specified in the
  1235. characteristics table for the protocol binding to the MAC.  The
  1236. characteristics table for the MAC actually does not supply a
  1237. lower dispatch table (the pointer to it is NULL).
  1238.  
  1239. LPBUF  Back pointer to common characteristics table
  1240. DWORD  Interface flags (used by Vector frame dispatch):
  1241.      0 - Handles non-LLC frames
  1242.      1 - Handles specific-LSAP LLC frames
  1243.      2 - Handles non-specific-LSAP LLC frames
  1244.      3-31 - Reserved must be zero
  1245. LPFUN  RequestConfirm address
  1246. LPFUN  TransmitConfirm address
  1247. LPFUN  ReceiveLookahead indication address
  1248. LPFUN  IndicationComplete address
  1249. LPFUN  ReceiveChain indication address
  1250. LPFUN  Status indication address
  1251.  
  1252. NOTE: No dispatch address is allowed to be NULL.
  1253.  
  1254. Characteristic Tables for NetBIOS Drivers
  1255.  
  1256. NetBIOS drivers written to the existing LAN Manager Ring0 NetBIOS
  1257. specification can be adapted to fit into the Protocol Manager
  1258. structure by defining a common characteristics table for them
  1259. shown below.  Note that such a NetBIOS driver must still respond
  1260. to the existing LAN Manager NetBIOS Linkage binding mechanism;
  1261. these drivers will only use Protocol Manager binding at their
  1262. lower boundary (to the MAC).  A variant kind of NetBIOS module
  1263. will be defined in the future that takes advantage of Protocol
  1264. Manager binding at both boundaries.
  1265.  
  1266. Common characteristics for NetBIOS drivers:
  1267.  
  1268. WORD      Size of common characteristics table (bytes)
  1269. BYTE      Major NDIS Version (2 BCD digits)
  1270. BYTE      Minor NDIS Version (2 BCD digits)
  1271. WORD      Reserved
  1272. BYTE      Major Module Version (2 BCD digits)
  1273. BYTE      Minor Module Version (2 BCD digits)
  1274. DWORD     Module function flags, 0x00000002 (binds lower)
  1275. BYTE[16]  NetBIOS Module name
  1276. BYTE      Protocol level at upper boundary of module:  5 = Session
  1277. BYTE      Type of interface at upper boundary of module:  1 = LANMAN NCB
  1278. BYTE      Protocol level at lower boundary of module: 1 = MAC
  1279. BYTE      Type of interface at lower boundary of module: 1 = MAC
  1280. WORD      NetBIOS Module ID
  1281. WORD      NetBIOS Module DS
  1282. LPFUN     System request dispatch entry point
  1283. LPBUF     Pointer to service-specific characteristics (see below)
  1284. LPBUF     Pointer to service-specific status, must be (NULL)
  1285. LPBUF     Pointer to upper dispatch table (see below)
  1286. LPBUF     Pointer to lower dispatch table (see below)
  1287. LPBUF     Reserved, must be NULL
  1288. LPBUF     Reserved, must be NULL
  1289.  
  1290. Upper dispatch table for a NetBIOS module:
  1291.  
  1292. LPBUF     Back pointer to common characteristics table
  1293. LPFUN     Request address
  1294. LPFUN     NetBIOS NCB handler (LANMAN calling conventions)
  1295.  
  1296. Lower dispatch table for a NetBIOS module:
  1297.  
  1298. LPBUF     Back pointer to common characteristics table
  1299. DWORD     Interface flags (used by Vector frame dispatch):
  1300.        0 - Handles non-LLC frames
  1301.        1 - Handles specific-LSAP LLC frames
  1302.        2 - Handles non-specific-LSAP LLC frames
  1303.        3-31 - Reserved must be zero
  1304. LPFUN     RequestConfirm address
  1305. LPFUN     TransmitConfirm address
  1306. LPFUN     ReceiveLookahead indication address
  1307. LPFUN     IndicationComplete address
  1308. LPFUN     ReceiveChain indication address
  1309. LPFUN     Status indication address
  1310.  
  1311. Service-specific characteristics for a NetBIOS module:
  1312.  
  1313. WORD        Length of NetBIOS module service-specific characteristics table
  1314. BYTE [16]   Type name of NetBIOS module, ASCIIZ format:
  1315. WORD        NetBIOS module type code
  1316.  
  1317. This may be followed by module-specific information.
  1318.  
  1319. The protocol type name will be used in future versions of this
  1320. specification.  Specific type names for different protocol types
  1321. will be defined later.  Protocol type codes will also be defined
  1322. later.  For the moment these two fields are simple place holders
  1323. and must be set to null string and zero respectively.
  1324.  
  1325. Frame Data Description
  1326.  
  1327. The MAC describes frame data with a data structure called a
  1328. buffer descriptor.  The descriptor is composed of pointers and
  1329. lengths which describe a logical frame.  Buffer descriptors are
  1330. ephemeral objects.  A descriptor is valid only during the scope
  1331. of the call that references it as a parameter.  The called
  1332. routine must not modify the descriptor in any way.  If the called
  1333. routine needs to refer to the described data blocks after
  1334. returning from the call, it must save the information contained
  1335. in the descriptor.
  1336.  
  1337. Data blocks described by descriptors are long-lived.  Ownership
  1338. of the data blocks is implicitly passed to the module that is
  1339. called with the descriptor.  The called module relinquishes
  1340. ownership back to the caller either via setting a return
  1341. argument, or by later issuing a call back to the supplying
  1342. module.  Under OS/2, some pointers may be either GDT virtual
  1343. addresses or physical addresses.  In this case the pointer has an
  1344. associated pointer type opcoded field.  Defined values are 0 for
  1345. physical address and 2 for GDT virtual addresses.  GDT virtual
  1346. addresses may be supplied to the MAC only if bit 14 of the
  1347. service flags in the MAC service specific characteristics table
  1348. is set.  The GDT address must remain valid throughout the scope
  1349. of its use by the MAC.
  1350.  
  1351. Under DOS there is no distinction between physical and virtual
  1352. addresses.  All addresses in this case are segment: offset.  Care
  1353. must be taken to ensure that the segment offset plus data length
  1354. do not exceed the 64K segment boundary.  The pointer type field
  1355. if present is always encoded as a 0.
  1356.  
  1357. For performance reasons, it is recommended that data blocks used
  1358. for transmission and reception be double-word aligned where
  1359. possible.  Both MAC and protocol NDIS drivers may choose to
  1360. perform byte, word or dword memory movement without first
  1361. ensuring proper alignment.  This will result in reduced
  1362. performance in combination with drivers which do not guarantee
  1363. such alignment.
  1364.  
  1365. A buffer descriptor may contain one or more data blocks of length
  1366. zero.  In this case the other fields in the data block (Data Ptr
  1367. and Data Type) may not be valid and must be ignored.
  1368.  
  1369. Transmit Buffer Descriptor
  1370.  
  1371. All transmit data is passed using a far pointer to a transmit
  1372. buffer descriptor, TxBufDescr.  The format of this descriptor is:
  1373.  
  1374. WORD   TxImmedLen   ;Byte count of immediate data; max is 64
  1375. LPBUF  TxImmedPtr   ;Virtual address of immediate data
  1376. WORD   TxDataCount  ;Count of remaining data blocks; max is 
  1377.                      configurable
  1378.  
  1379. Followed by TxDataCount instances of:
  1380.  
  1381. BYTE   TxPtrType    ;Type of pointer (0=Physical, 2=GDT)
  1382. BYTE   TxResByte    ;Reserved Byte (must be 0)
  1383. WORD   TxDataLen    ;Length of data block
  1384. LPBUF  TxDataPtr    ;Address of data block
  1385.  
  1386. In a TxBufDescr structure, the immediate data described by the
  1387. first two fields is ephemeral and may be referenced only during
  1388. the scope of the call that supplies it.  Such immediate data is
  1389. always transmitted before data described by TxDataLen and
  1390. TxDataPtr pairs.  If the called routine needs to refer to the
  1391. immediate data after returning from the call, it must copy the
  1392. data.  The maximum size of immediate data is 64 bytes.  For
  1393. V2.0.1 MACS or later the maximum TxDataCount is specified in the
  1394. MAC specific characteristics table.  For V1.0.1 MACs the maximum
  1395. count is 8.
  1396.  
  1397. Transfer Data Buffer Descriptor
  1398.  
  1399. Transfer data can be described by a far pointer to a transfer
  1400. data buffer descriptor, TDBufDescr.  Transfer data buffer
  1401. descriptors have the following format:
  1402.  
  1403. WORD     TDDataCount    ;Count of transfer data blocks; max is
  1404.                          configurable
  1405.  
  1406. Followed by TDDataCount instances of:
  1407.  
  1408. BYTE     TDPtrType      ;Type of pointer (0=Physical, 2=GDT)
  1409. BYTE     TDResByte      ;Reserved Byte (must be 0)
  1410. WORD     TDDataLen      ;Length of data block
  1411. LPBUF    TDDataPtr      ;Address of data block
  1412.  
  1413. For V2.0.1 MACs or later the maximum TDDataCount is specified in
  1414. the MAC specific characteristics table.  For V1.0.1 MACs the
  1415. maximum count is 8.
  1416.  
  1417. Receive Chain Buffer Descriptor
  1418.  
  1419. Receive chain data can be passed by a far pointer to a receive
  1420. chain buffer descriptor, RxBufDescr.  Receive chain buffer
  1421. descriptors have the following format:
  1422.  
  1423. WORD     RxDataCount    ;Count of receive data blocks; max is
  1424.                         configurable
  1425.  
  1426. Followed by RxDataCount instances of:
  1427.  
  1428. WORD     RxDataLen      ;Length of data block
  1429. LPBUF    RxDataPtr      ;Virtual address of data block
  1430.  
  1431. For V2.0.1 MACs or later the maximum receive data block count is
  1432. specified in the MAC specific characteristics table.  For V1.0.1
  1433. MACs the maximum count is 8.
  1434.  
  1435. For received frames that are larger than 256 bytes, the first
  1436. data block of the frame must be at least 256 bytes long.  Frames
  1437. less than or equal to 256 bytes will be passed up with
  1438. RxDataCount equal to 1.
  1439.  
  1440.  
  1441. PROTOCOL.INI
  1442.  
  1443. The PROTOCOL.INI file stores configuration and binding
  1444. information for all the protocol and MAC modules in the system.
  1445. The file uses the same general format as the LANMAN.INI file.  It
  1446. consists of a series of named sections, where the section name is
  1447. in fact the module name from a module characteristics table.
  1448. Below the bracketed module name is a set of configuration
  1449. settings for the module in name=value format.  For example:
  1450.  
  1451. [MYNetBIOS]
  1452. Drivername = NetBIOS$
  1453. Bindings = ETHERCARD
  1454. MaxNCBs = 16
  1455. MaxSessions = 32
  1456. MaxNames = 16
  1457.  
  1458. The rules for PROTOCOL.INI contents are:
  1459.  
  1460. - Bracketed module name.  Must be the name of a protocol or MAC
  1461.   module, e.g. [MYNetBIOS].  This is the name of the module as
  1462.   defined in that module's characteristics table.  The name must
  1463.   be 15 characters or less (not counting the brackets).  Mixed
  1464.   case may be used but the Protocol Manager will convert it to
  1465.   uppercase when it reads the file into memory.
  1466.  
  1467. - Drivername = <device driver name>.  This parameter is required
  1468.   for all device driver modules.  It defines the name of the OS/2
  1469.   or DOS device driver that the module is contained in.  Note
  1470.   that a single device driver name may be mentioned by several
  1471.   sections of the PROTOCOL.INI file, if the driver contains
  1472.   multiple logical modules.  The Drivername parameter is the
  1473.   recommended method by which a module searches for its module
  1474.   section in the PROTOCOL.INI file to get its configuration
  1475.   parameters.  This allows the module to find all relevant module
  1476.   sections based on a single name intrinisic to the module
  1477.   independent of the particular bracketed module name used in the
  1478.   PROTOCOL.INI file.  This keyword is also required for DOS
  1479.   dynamic modules like TSRs or transient application modules.
  1480.   Although there is no driver name instrinsically assigned to
  1481.   such modules it is required that a unique name be assigned to
  1482.   this keyword for such modules anyway.  In this way the same
  1483.   search mechanism used by device drivers can be used by dynamic
  1484.   DOS modules to find their relevant module sections in
  1485.   PROTOCOL.INI.
  1486.  
  1487. - Bindings = <module name> | <module name>,<module name>, . . .
  1488.   This parameter is optional for protocol modules.  It is not
  1489.   valid for MAC modules.  If present, it is used by the protocol
  1490.   module to determine what MAC modules it will ask to bind to.
  1491.   (In other words, changing this parameter in the PROTOCOL.INI
  1492.   file can reconfigure a protocol to bind to a different MAC.).
  1493.   The Bindings parameter may be omitted if the protocol driver
  1494.   software is preconfigured to bind to a particular MAC, or if      
  1495.   the system will only contain one MAC and one static protocol
  1496.   module.  In the latter case (only in static mode), the Protocol
  1497.   Manager by default will ask the one static protocol to bind to
  1498.   the one MAC.
  1499.  
  1500. - Other keywords and parameters.  Any other keyword=value
  1501.   statements are module specific.  Keyword names must be 15
  1502.   characters or less.  They may be mixed case but are converted
  1503.   to uppercase when read by the Protocol Manager.  Note that
  1504.   keyword names are unique within the scope of each <module name>
  1505.   section and can appear within the section in any order.
  1506.  
  1507. - Whitespace around the equals sign is not significant, nor is
  1508.   trailing white space on the line.  Except for this leading and
  1509.   trailing white space, all other characters of the value string
  1510.   are taken verbatim.
  1511.  
  1512. - A list of 0 or more parameters can appear to the right of the
  1513.   equals sign.  If there are no parameters the equals sign can be
  1514.   optionally omitted.  A parameter is terminated by a space, tab,
  1515.   comma, or semicolon.  No parameters are interpreted by the
  1516.   Protocol Manager.
  1517.  
  1518. - A parameter can either be up to a 31-bit signed numeric value
  1519.   or a string of any length.
  1520.  
  1521. - A numeric parameter can be expressed either in decimal or
  1522.   hexadecimal format.  All numeric parameters must start with the
  1523.   characters '0' through '9' or by a + or - followed by the '0'
  1524.   to'9' character.  A hexadecimal parameter must start with '0x'
  1525.   or '0X' and use valid hexadecimal digits.  A non-hexadecimal
  1526.   numeric parameter is treated as decimal integer.  A parameter
  1527.   not surrounded by quotes and starting with 0 to 9 or + and -
  1528.   followed by 0 to 9 will be assumed to be a numeric parameter.
  1529.  
  1530. - A string is a parameter which either starts with a non-numeric
  1531.   character or is surrounded with quotes ("....").  The string is
  1532.   preserved in the memory image as it appears in PROTOCOL.INI.
  1533.  
  1534. - A line starting with a semicolon in column 1 is a comment and
  1535.   is ignored.  Blank lines are ignored too.
  1536.  
  1537. - Lines may be as long as required.  Continuation lines are not
  1538.   supported.  Lines end with CR LF.
  1539.  
  1540. - Tabs, formfeeds, and spaces are considered to be white space.
  1541.  
  1542. The Protocol Manager supports an optional section with optional
  1543. keywords defined below:
  1544.  
  1545. [PROTMAN]
  1546. Drivername = PROTMAN$
  1547. Dynamic = YES or NO
  1548. PRIORITY = prot1, prot2, ...
  1549. Bindstatus = YES or NO
  1550.  
  1551. The bracketed module name can be any valid name as long as it is
  1552. unique within this PROTOCOL.INI.  Drivername is required and must
  1553. be assigned PROTMAN$, identifying the section as belonging to the
  1554. Protocol Manager.  None of the entries are case-sensitive.
  1555.  
  1556. The DYNAMIC keyword is optional.  It defaults to NO if not
  1557. present.  If set to NO, the Protocol Manager operates only in the
  1558. static mode and does not support dynamic protocol drivers.  If
  1559. set to YES, the Protocol Manager operates in the dynamic mode and
  1560. supports both static and dynamic binding.
  1561.  
  1562. The PRIORITY keyword is optional.  If absent, then the VECTOR
  1563. uses default demultiplexing priority if multiple protocol drivers
  1564. are bound to the same MAC (see Vector Demultiplexing in Chapter
  1565. 7).  If present, the parameters on the right-hand side are
  1566. presumed to be a list of protocol module names, highest priority
  1567. first.  The VECTOR prioritizes protocol drivers for
  1568. demultiplexing (if necessary) according to their order in the
  1569. list, and packets are offered to the first protocol driver listed
  1570. first.  Protocol drivers not listed are assigned default priority
  1571. AFTER those listed.  It is not necessary that a protocol driver
  1572. ever bind for it to be listed here.
  1573.  
  1574. The BINDSTATUS keyword is optional.  If absent, then the
  1575. BindStatus command is not supported by the Protocol Manager.  If
  1576. set to YES, then BindStatus is supported by the Protocol Manager.
  1577. The default disable condition is a memory optimization feature
  1578. primarily for DOS environments.
  1579.  
  1580. When syntax errors are detected in processing the PROTOCOL.INI
  1581. commands, by convention, all NDIS drivers should:
  1582.  
  1583.      1)     Display a error message detail exact syntax problem.
  1584.      2)     Assume some non-fatal value for the parameter associated
  1585.             with the error and complete processing. 
  1586.  
  1587. Configuration Memory Image
  1588.  
  1589. When the Protocol Manager initializes, it reads PROTOCOL.INI and
  1590. parses it into a memory image that it makes available to MAC and
  1591. protocol modules via the Get Protocol Manager Info call.  The
  1592. parsed image is formatted to make it easy for run-time modules to
  1593. interpret.  All information contained in PROTOCOL.INI is present
  1594. in the memory image in the same order as in the file.  (Comments
  1595. and white space are of course not present in the image).  Note
  1596. that in static mode the image is only available during device
  1597. driver initialization time.  In dynamic mode the image may
  1598. additionally be created by a utility which then registers it with
  1599. the Protocol Manager.
  1600.  
  1601. The structure definitions defined below do not conform rigorously
  1602. to C language syntax.  They provide a pseudo C-like language to
  1603. define the data structures encoded in the configuration memory
  1604. image.
  1605.  
  1606. ConfigMemoryImage
  1607.  
  1608. The ConfigMemoryImage data structure defines the complete memory
  1609. image for all logical devices read from the PROTOCOL.INI
  1610. configuration file.  It is a doubly linked list of ModuleConfig
  1611. structures.  Each ModuleConfig structure corresponds to one
  1612. module.  The ConfigMemoryImage structure is defined as follows:
  1613.  
  1614. struct ConfigMemoryImage
  1615. {
  1616.         struct Module Config(1) Module(1);
  1617.         struct Module Config(2) Module(2);
  1618.         . . .
  1619.         struct ModuleConfig(N) Module(N);
  1620. };
  1621.  
  1622. where:
  1623.  
  1624. N=the number of modules encountered by the Protocol Manager when
  1625. parsing the configuration file PROTOCOL.INI.
  1626.  
  1627. ModuleConfig
  1628.  
  1629. The ModuleConfig(i) structure defines the memory image for
  1630. configuration parameters corresponding to one (bracketed name)
  1631. module.  For the (i)th module specified in PROTOCOL.INI it is
  1632. defined as follows:
  1633.  
  1634. struct ModuleConfig(i)
  1635. {
  1636.        struct ModuleConfig(i+1) far *NextModule;
  1637.        struct ModuleConfig(i-1) far *Prev Module;
  1638.        unsigned char Module Name [16];
  1639.        struct KeywordEntry(1) KeywordEntry(1);
  1640.        struct KeywordEntry(2) KeywordEntry(2);
  1641.        . . .
  1642.        struct KeywordEntry(N) KeywordEntry(N);
  1643. };
  1644.  
  1645. where:
  1646.  
  1647. N = the number of keyword entries encountered in the PROTOCOL.INI
  1648. file for this module.
  1649.  
  1650. NextModule = a FAR pointer to the next module configuration
  1651. structure.  NULL if this is the structure for the last module.
  1652. For OS/2 the selector is a Ring 3 selector.  For DOS the pointer
  1653. is a segment:offset pair.
  1654.  
  1655. PrevModule = a FAR pointer to the previous module configuration
  1656. structure.  NULL if this is the structure for the first module.
  1657. For OS/2 the selector is a Ring 3 selector.  For DOS the pointer
  1658. is a segment:offset pair.
  1659.  
  1660. ModuleName = array containing the characters of the module name
  1661. (given in brackets in the configuration file).  This is an ASCIIZ
  1662. string consisting of a maximum of 15 non-null uppercase characters.
  1663.  
  1664. KeywordEntry
  1665.  
  1666. For each keyword line in the configuration file for the module a
  1667. memory image structure is created specifying the keyword and the
  1668. parameter values.  The (j)th keyword encountered in the
  1669. PROTOCOL.INI file for the module is defined as follows:
  1670.  
  1671. struct KeywordEntry(j)
  1672. {
  1673.         struct KeywordEntry(j+1) far *NextKeywordEntry;
  1674.         struct KeywordEntry(j-1) far *PrevKeywordEntry;
  1675.         unsigned char Keyword[16];
  1676.         unsigned NumParams;
  1677.         struct Param(1) Param(1);
  1678.         struct Param(2) Param(2);
  1679.         . . .
  1680.         struct Param(N) Param(N);
  1681. };
  1682.  
  1683. where:
  1684.  
  1685. N = the number of parameters entered with the keyword.  If N =0
  1686. the parameters are not present.
  1687.  
  1688. NextKeywordEntry = a FAR pointer to the next keyword entry
  1689. structure in the memory image.  NULL if this is the last keyword
  1690. entry.  For OS/2 the selector is a Ring 3 selector.  For DOS the
  1691. pointer is a segment:offset pair.
  1692.  
  1693. PrevKeywordEntry = a FAR pointer to the previous keyword entry
  1694. structure in the memory image.  NULL if this is the first keyword
  1695. entry.  For OS/2 the selector is a Ring 3 selector.  For DOS the
  1696. pointer is a segment:offset pair.
  1697.  
  1698. Keyword = the array containing the characters of the keyword
  1699. found in the configuration file.  This is an ASCIIZ string
  1700. consisting of a maximum of 15 non-null characters.  The case of
  1701. alphabetic characters will be uppercase in the memory image.
  1702.  
  1703. NumParams = the number (N) of parameters entered with the keyword
  1704. each parameter described by a param structure.  The value is 0 if
  1705. no parameters were present.
  1706.  
  1707. Param(k) = the (k)th parameter structure to specify the value of
  1708. one parameter in a list of parameters for a keyword.
  1709. "Param(k+1)" follows Param(k) in sequence within the memory
  1710. image.  Each parameter is delimited by a length field for the
  1711. parameter.  It is assumed that a keyword's fields will be parsed
  1712. sequentially.
  1713.  
  1714. Param
  1715.  
  1716. For the (k)th parameter defined in a parameter list for a
  1717. specific keyword the following structure defines its value and
  1718. attributes:
  1719.  
  1720. struct Param(k)
  1721. {
  1722.        unsigned ParamType;
  1723.        unsigned ParamLen;
  1724.        union ParamValue
  1725.        {
  1726.             long Numeric;
  1727.             unsigned char String[STRINGLEN];
  1728.        };
  1729. };
  1730.  
  1731. where:
  1732.  
  1733. STRINGLEN = length of the ASCIIZ parameter string (including the
  1734. terminating NULL) for string parameters.
  1735.  
  1736. ParamType = the type of parameter.  The following types are supported:
  1737.             0 - signed integer supporting up to 31 bit values least
  1738.                 significant byte first.
  1739.             1 - a string of characters.
  1740.  
  1741. ParamLen = the length of the parameter value.  The length
  1742.     could be one of the following either be 4 for numeric
  1743.     parameters or STRINGLEN for string parameters where
  1744.     STRINGLEN is the length of the string (including the
  1745.     terminating NULL).
  1746.  
  1747. Numeric = a 31-bit signed numeric value.
  1748.  
  1749. String = an ASCIIZ character string.  The case of alphabetic
  1750. characters in the string is preserved from that in PROTOCOL.INI.
  1751.  
  1752. The size of the Param (k) structure is thus ParamLen + 4.
  1753.  
  1754.  
  1755. BindingsList
  1756.  
  1757. For each module that registers with the Protocol Manager a
  1758. BindingsList structure may be given to the Protocol Manager
  1759. specifying the set of modules that the given module wishes to
  1760. bind to.  The current module will require services from these
  1761. other modules.  This structure is defined as follows:
  1762.  
  1763. struct BindingsList
  1764. {
  1765.      unsigned NumBindings;
  1766.      struct Module
  1767.      {
  1768.           char ModuleName[16];
  1769.  
  1770.      } BoundDriver[NUMBINDINGS];
  1771. };   
  1772.  
  1773. where:
  1774.  
  1775. NumBindings = the number (NUMBINDINGS) of modules that the
  1776. specified module wants to be bound to it from below.  In the
  1777. static default binding mode of one static protocol and one MAC, a
  1778. value of 0 in this field means for the protocol that it will bind
  1779. to the MAC.  Otherwise in the non-default binding mode, a value
  1780. of 0 in this field means that the module has no lower bindings.
  1781.  
  1782. ModuleName = an ASCIIZ string specifying the logical name of a
  1783. module which the current module wishes to have bound to it from
  1784. below.  Maximum of 15 non-null characters.  The Protocol Manager
  1785. will convert all alphabetic characters to uppercase.
  1786.  
  1787. BoundDriver = an array of NUMBINDINGS module names specifying the
  1788. list of modules to which the current module wants to be bound.
  1789.  
  1790. The order of the modules in the list is significant in that
  1791. InitiateBind requests will be issued to the protocol module in
  1792. this order.
  1793.  
  1794.  
  1795. Chapter 5:  Specification of Primitives
  1796.  
  1797. Implementers should obey the following general guidelines:
  1798.  
  1799. - All primitives specified in this section can be called in
  1800.   protected mode in either interrupt or task context under OS/2.
  1801.   Since any primitive may be called in interrupt context it is
  1802.   illegal to block during the execution of a primitive.
  1803.  
  1804. - All routines must run (as much as possible) with interrupts
  1805.   enabled.  Interrupt handlers must dismiss the interrupt at the
  1806.   8259 as soon as possible.
  1807.  
  1808. - An indication handler will normally be entered with interrupts
  1809.   enabled.  The handler may enable or disable interrupts if it
  1810.   chooses and on return the MAC must assume that the interrupt
  1811.   state may have been changed.
  1812.  
  1813. - Under MS-DOS indication handlers must assume they have only 200
  1814.   bytes of stack space.  If more stack space is needed then the
  1815.   handler must supply a stack.
  1816.  
  1817. - Confirmation and IndicationComplete handlers must be fully re-
  1818.   entrant and are always entered with interrupts enabled.  Under
  1819.   DOS Confirmation and IndicationComplete handlers must assume
  1820.   they are entered on whatever stack the interrupt occurred on.
  1821.  
  1822. - A confirmation handler may be entered with the confirmation for
  1823.   a request before the request has returned.
  1824.  
  1825. - It is recommended that a MAC release the internal resources
  1826.   associated with either TransmitChain or a request before
  1827.   calling the confirmation handler.  This allows the protocol to
  1828.   submit a new TransmitChain or request from the confirmation
  1829.   handler.  Failing to do so may have a significant impact on
  1830.   performance.
  1831.  
  1832. - A protocol must assume whenever it gives control to a MAC that
  1833.   interrupts may be enabled by the MAC unless otherwise
  1834.   explicitly specified.
  1835.  
  1836. - When passing a virtual address to one of these primitives under
  1837.   OS/2 the address must be a Ring 0 GDT address unless otherwise
  1838.   specified.  The interrupt service routine portion of the MAC
  1839.   must handle the fact that this address may not be valid if an
  1840.   interrupt occurs in real mode.
  1841.  
  1842. - All primitives have a set of specific error codes defined.  In
  1843.   general, MAC's and protocols must return these specific codes.
  1844.   However it is acceptable to return GENERAL_FAILURE for any non-
  1845.   recoverable failure.  NDIS developers must be aware that new
  1846.   error codes may be added in the future and must design their
  1847.   code to allow for this.
  1848.  
  1849. - If a particular entry point or function is not supported by an
  1850.   NDIS protocol or MAC driver, the entry point must still be
  1851.   exposed and an error (INVALID_FUNCTION 0x0008) returned if it
  1852.   is called.  Crashing when an unsupported request is made is
  1853.   unacceptable.
  1854.  
  1855. - Parameters are passed on the stack compatible with Microsoft C
  1856.   FAR Pascal calling conventions.  On entry to any routine the
  1857.   called module must save the caller's DS before setting its DS
  1858.   from the "dataseg" parameter.  At exit the caller's DS must be
  1859.   restored.  Furthermore the called module must follow standard
  1860.   Microsoft C conventions about saving "register variable" SI and
  1861.   DI registers if these are used.  Modules which use the 80386
  1862.   registers EDI, ESI and EBP must preserve these registers also.
  1863.   The direction bit is assumed to be clear on entry and must be
  1864.   clear upon exit.  These conventions apply for calls in both
  1865.   directions across the NDIS MAC interface.
  1866.  
  1867. - Direct calls return in AX a return code specifying the status
  1868.   of function invocation.  Those functions specified as using
  1869.   IOCTLs return this in the status field of the request block.
  1870.  
  1871. - Before calling a module in OS/2 it is the caller's
  1872.   responsibility to ensure that it is currently executing in
  1873.   protected mode.  If it is running in real mode it must do an
  1874.   OS/2 "RealToProt"  DevHlp call before calling the inter-module
  1875.   interface function.  Furthermore in OS/2 the inter-module call
  1876.   can only be made at post CONFIG.SYS INIT time since all
  1877.   selectors are Ring 0 selectors.
  1878.  
  1879. - A MAC starts with packet reception disabled.  A protocol must
  1880.   call SetPacketFilter to enable reception of packets.
  1881.  
  1882. - It is recommended that the number of Request commands which can
  1883.   be simultaneously queued by the MAC be configurable.  The
  1884.   suggested keyword in the configuration file is "MaxRequests."
  1885.   The recommended default is 6.  The suggested range is 1 to 10.
  1886.  
  1887. - The number of TransmitChain commands which can be
  1888.   simultaneously queued by the MAC must be configurable.  The
  1889.   suggested keyword in the configuration file is "MaxTransmits".
  1890.   The recommended default is 6.  The suggested range is 1 to 50.
  1891.  
  1892. - On a DIX or 802.3 network, packet buffers received may have
  1893.   been padded to the minimum packet size for short packets.  It
  1894.   is the responsibility of the MAC client to examine the length
  1895.   field if present and strip off the padding.
  1896.  
  1897. - For DIX or 802.3 networks the MAC client can transmit a buffer
  1898.   with packet length smaller than the minimum.  It is the
  1899.   responsibility of the MAC to provide the required padding bytes
  1900.   before transmission on to the wire.  The content of the padding
  1901.   bytes is undefined.
  1902.  
  1903. - Protocol drivers conforming to this specification are expected
  1904.   to format and interpret MAC headers for the MAC driver types
  1905.   supported.  Generally, protocols are expected to support
  1906.   802.3, DIX, and 802.5 MAC headers. It is recommended that  MAC
  1907.   drivers for other media types consider claiming to be one of
  1908.   the above types and doing a transparent internal mapping
  1909.   between that and its own private MAC header format.  In doing
  1910.   so, the MAC will be able to claim interoperability (assuming 
  1911.   the appropriate testing is done) with most protocol drivers
  1912.   developed for LAN Manager.
  1913.  
  1914. - In the absence of any such conversion, the MAC header is passed
  1915.   protocol-to-MAC or MAC-to-protocol in exactly the format in
  1916.   which it exists on the medium.  The CRC and non-data fields are
  1917.   not passed across this boundary.  Therefore the Ethernet CRC
  1918.   and the Token Ring SD, FCS, ED and FS fields are not passed and
  1919.   will not be included in the packet length.  The protocol must
  1920.   convert header fields found in the header buffer passed up to
  1921.   whatever format is required to conveniently store them in local
  1922.   memory.  For example multi-byte fields (e.g., 802.3 length) may
  1923.   not be received in the byte order that is normally used by the
  1924.   CPU for storing multi-byte parameters.  For exact format of the
  1925.   MAC header refer to the appropriate standards document (see
  1926.   Appendix B).
  1927.  
  1928. - For performance reasons, it is recommended that PhysToGDT be
  1929.   used whenever possible instead of PhysToVirt.
  1930.  
  1931. - Commonly Used Parameters
  1932.  
  1933. ProtID      The unique module ID of the protocol, assigned at bind
  1934.             time by the Protocol Manager.
  1935.  
  1936. MACID       The unique module ID of the MAC, assigned at bind time
  1937.             by the Protocol Manager.
  1938.  
  1939. ReqHandle   A handle assigned by the protocol to identify this
  1940.             request.  If the request is implemented asynchronously
  1941.             by the MAC driver in question, this handle is returned
  1942.             on the confirmation call used to indicate completion of
  1943.             the request.  A ReqHandle of 0 indicates that the
  1944.             confirmation be unconditionally suppressed.  For
  1945.             example, the request may still be handled
  1946.             asynchronously but there will be no notification of
  1947.             completion.  A ReqHandle of 0 must not change the
  1948.             immediate return code.
  1949.  
  1950. ProtDS      DS value for called protocol module, obtained from the
  1951.             module's dispatch table at bind time.
  1952.  
  1953. MACDS       DS value for called MAC module, obtained from the
  1954.             module's dispatch table at bind time.
  1955.  
  1956.  
  1957. Direct Primitives
  1958.  
  1959.  
  1960. TransmitChain
  1961.  
  1962. Purpose:  Initiate transmission of a frame
  1963.  
  1964. PUSHWORD      ProtID         ;Module ID of protocol
  1965. PUSHWORD      ReqHandle      ;Unique handle for this request or 0
  1966. PUSHLPBUF     TxBufDescr     ;Pointer to framebufferdescriptor
  1967. PUSHWORD      MACDS          ;DS of called MAC module
  1968. CALL TransmitChain
  1969.  
  1970. Returns:    0x0000    SUCCESS
  1971.             0x0002    REQUEST_QUEUED
  1972.             0x0006    OUT_OF_RESOURCE
  1973.             0x0007    INVALID_PARAMETER
  1974.             0x0008    INVALID_FUNCTION
  1975.             0x000A    HARDWARE_ERROR
  1976.             0x000B    TRANSMIT_ERROR
  1977.             0x000C    NO_SUCH_DESTINATION
  1978.             0x00FF    GENERAL_FAILURE
  1979.  
  1980. TxBufDescr  Far pointer to the buffer descriptor for the frame.
  1981.  
  1982. Description:
  1983.  
  1984. This call asks the MAC to transmit data.  The MAC may either copy
  1985. the data described by TxBufDescr before returning, or queue the
  1986. request for later (asynchronous) processing.  The MAC indicates
  1987. which option it is taking by setting the appropriate return code.
  1988.  
  1989. In the asynchronous case, ownership of the frame data blocks
  1990. passes to the MAC until the transmission is complete; the
  1991. protocol must not modify these areas until then.  Ownership of
  1992. the data blocks is returned to the protocol when the MAC either
  1993. returns a status code which implies completion of the original
  1994. request or calls its TransmitConfirm entry with the ReqHandle
  1995. from TransmitChain.  If a request handle of zero was used and
  1996. therefore TransmitConfirm will not be called, then ownership must
  1997. not be considered returned until the protocol receives a message
  1998. that implies the transmission has occurred (e.g., receiving an
  1999. ACK to the transmitted message).
  2000.  
  2001. Note that when doing asynchronous transmission, the MAC must
  2002. retain any needed information from TxBufDescr, since the pointer
  2003. to that structure becomes invalid upon returning from
  2004. TransmitChain.  Also, if the TxImmedLen of the descriptor is non-
  2005. zero, the MAC must retain a copy of the immediate data at
  2006. TxImmedPtr, since the immediate data area becomes invalid upon
  2007. returning from TransmitChain.
  2008.  
  2009. The MAC header must fit entirely in the immediate data, if
  2010. present, or in the first non-immediate element described in
  2011. TxBufDescr if there is no immediate data.
  2012.  
  2013. A MAC must be prepared to handle a TransmitChain request at
  2014. anytime, including from within interrupt-time indication
  2015. routines.
  2016.  
  2017. The return code REQUEST_QUEUED will cause a TransmitConfirm to be
  2018. called from the MAC back to the protocol if the ReqHandle on the
  2019. TransmitChain call is not 0.  All other return codes from
  2020. TransmitChain imply that no TransmitConfirm will occur.
  2021.  
  2022. The TRANSMIT_ERROR and NO_SUCH_DESTINATION error codes are
  2023. intended to allow a protocol to recreate the frame status byte on
  2024. a Token Ring network.  Thus, NO_SUCH_DESTINATION implies that the
  2025. address recognized bits were not set (and therefore the frame was
  2026. not copied), while TRANSMIT_ERROR merely means that the frame was
  2027. not copied.  Protocols which make use of Source Routing may need
  2028. the NO_SUCH_DESTINATION error code to be completely conformant.
  2029. Token Ring MAC driver writers must make every attempt to return
  2030. these error codes properly.
  2031.  
  2032.  
  2033. TransmitConfirm
  2034.  
  2035. Purpose:  Imply the completion of transmitting a frame.
  2036.  
  2037. PUSH WORD      ProtID      ;Module ID of Protocol
  2038. PUSH WORD      MACID       ;Module ID of MAC
  2039. PUSH WORD      ReqHandle   ;Unique handle from TransmitChain
  2040. PUSH WORD      Status      ;Status of original TransmitChain
  2041. PUSH WORD      ProtDS      ;DS of called protocol module
  2042. CALL  TransmitConfirm
  2043.  
  2044. Returns:      0x0000    SUCCESS
  2045.               0x0007    INVALID_PARAMETER
  2046.               0x00FF    GENERAL_FAILURE
  2047.  
  2048. Description:
  2049.  
  2050. This routine is called by a MAC to indicate completion of a
  2051. previous TransmitChain.  The purpose of this is to return
  2052. ownership of the transmitted data blocks back to the protocol.
  2053.  
  2054. The ProtID parameter must be the value passed by the protocol on
  2055. the previous TransmitChain to identify the requestor.
  2056.  
  2057. The ReqHandle is the value passed by the protocol on the previous
  2058. TransmitChain which identifies the original request.
  2059.  
  2060. TransmitConfirm does not necessarily imply that the packet has
  2061. been transmitted, though it generally will have been (with the
  2062. exception of some intelligent adapter implementations).  If the
  2063. packet has been transmitted, Status must indicate the final
  2064. transmit status:
  2065.  
  2066.   0X0000  SUCCESS
  2067.   0X000A  HARDWARE_ERROR
  2068.   0X000B  TRANSMIT_ERROR
  2069.   0X000C  NO_SUCH_DESTINATION
  2070.   0X00FF  GENERAL_FAILURE
  2071.  
  2072. See TransmitChain for more details.
  2073.  
  2074.  
  2075. ReceiveLookahead
  2076.  
  2077. Purpose:  Indicate arrival of a received frame and offer lookahead data.
  2078.  
  2079. PUSH WORD     MACID        ;Module ID of MAC
  2080. PUSH WORD     FrameSize    ;Total size of frame (0 if not known)
  2081. PUSH WORD     BytesAvail   ;Bytes of lookahead available in Buffer
  2082. PUSH LPBUF    Buffer       ;Virtual address of lookahead data
  2083. PUSH LPBYTE   Indicate     ;Virtual address of indicate flag
  2084. PUSH WORD     ProtDS       ;DS of called protocol module
  2085. CALL  ReceiveLookahead
  2086.  
  2087. Returns:  0x0000    SUCCESS
  2088.           0x0003    FRAME_NOT_RECOGNIZED
  2089.           0x0004    FRAME_REJECTED
  2090.           0x0005    FORWARD_FRAME
  2091.           0x0006    OUT_OF_RESOURCE
  2092.           0x0007    INVALID_PARAMETER
  2093.           0x00FF    GENERAL_FAILURE
  2094.  
  2095.  
  2096. FrameSize   The total size, in bytes, of the received frame.  A
  2097.             value of 0 indicates that the MAC does not know the
  2098.             total frame size at this time.
  2099.  
  2100. BytesAvail  The number of bytes available in the lookahead
  2101.             buffer.  This is guaranteed to be at least as large as
  2102.             the lookahead size established with the SetLookahead
  2103.             request.  For frames which are smaller than the
  2104.             lookahead size, the lookahead buffer will contain the
  2105.             whole frame.
  2106.  
  2107. Buffer      Virtual address of contiguous lookahead buffer.  The
  2108.             buffer contains the leading BytesAvail octets of the
  2109.             frame.  This buffer is ephemeral; it is addressable to
  2110.             the protocol only during the scope of the Receive call.
  2111.  
  2112. Indicate    Virtual address of indication flag byte.  This byte is
  2113.             set to 0xFF by the MAC prior to this call.  If the
  2114.             protocol clears the byte to zero prior to returning
  2115.             then indications will be left disabled until
  2116.             IndicationOn is called from IndicationComplete.
  2117.  
  2118. Description:
  2119.  
  2120. This routine is called by a MAC to indicate reception of a frame
  2121. and to offer frame lookahead data.  The protocol is expected to
  2122. inspect this information very rapidly to determine if it wants to
  2123. accept the frame or not.  If it wants to accept the frame, it may
  2124. call TransferData to ask the MAC to copy the frame data to a
  2125. specified buffer described by a TDBufDescr.  The protocol can
  2126. indicate that it is rejecting or does not recognize the frame by
  2127. returning an appropriate error code.  Note that the frame not
  2128. recognized error has special significance to the Vector function.
  2129. If the protocol is accepting the frame and if the lookahead
  2130. buffer contains the whole frame, the protocol can simply copy the
  2131. data itself before returning from Receive.  The protocol may
  2132. determine that it has the whole frame if BytesAvail equals
  2133. FrameSize, or if the lookahead information includes a protocol
  2134. header with the frame length, and this matches BytesAvail.
  2135.  
  2136. It is strongly recommended that MACs provide a non-zero FrameSize
  2137. whenever possible.  Some protocols might not be able to process
  2138. frames unless the frame size given by this parameter is known.  A
  2139. MAC can optionally indicate that it does not normally provide a
  2140. non-zero frame size by setting bit 16 of the service flags in the
  2141. MAC specific characteristics table.
  2142.  
  2143. The MAC implicitly disables indications (IndicationOff) before
  2144. calling Receive Lookahead.  The Indicate flag byte instructs the
  2145. MAC on whether to reenable indications or leave them disabled on
  2146. the return. If the protocol chooses to leave indications
  2147. disabled, it can enable them within IndicationComplete by calling
  2148. IndicationOn.
  2149.  
  2150. The protocol must absolutely minimize its processing time within
  2151. the ReceiveLookahead handler.  This is necessary to let certain
  2152. MAC's re-enable the hardware to avoid loss of incoming frames.
  2153. Shortly after returning from ReceiveLookahead, the MAC will call
  2154. the protocol back at its IndicationComplete entry point.  The
  2155. protocol can do any needed post-processing of the received frame
  2156. at that time.  The MAC does not guarantee to provide one
  2157. IndicationComplete call for each indication.  It can choose to
  2158. issue a single IndicationComplete for several indications that
  2159. have occurred.
  2160.  
  2161.  
  2162. TransferData
  2163.  
  2164. Purpose:  Transfer received frame data from the MAC to a protocol.
  2165.  
  2166. PUSH LPWORD   BytesCopied    ;Number of bytes copied
  2167. PUSH WORD     FrameOffset    ;Starting offset in frame for transfer
  2168. PUSH LPBUF    TDBufDescr     ;Virtual address of transfer data description
  2169. PUSH WORD     MACDS          ;DS of called MAC module
  2170. CALL TransferData
  2171.  
  2172. Returns:    0x0000    SUCCESS
  2173.      0x0007    INVALID_PARAMETER
  2174.      0x0008    INVALID_FUNCTION
  2175.      0x00FF    GENERAL_FAILURE
  2176.  
  2177.  
  2178. BytesCopied   Virtual address of buffer for returning number of
  2179.               bytes copied during transfer data operation.
  2180.  
  2181. FrameOffset   Starting offset in received frame where data transfer
  2182.               must start.  The value of FrameOffset must be less
  2183.               than or equal to the value of BytesAvail from the
  2184.               corresponding ReceiveLookahead.
  2185.  
  2186. TDBufDescr    Virtual address of transfer descriptor describing
  2187.               where to store the frame data.
  2188.  
  2189. Description:
  2190.  
  2191. A protocol calls this synchronous routine from within its
  2192. ReceiveLookahead handler before return, to ask the MAC to
  2193. transfer data for a received frame to protocol storage.  The
  2194. protocol can specify any starting frame offset and byte count for
  2195. the transfer, so long as these don't exceed the frame's length.
  2196. If bit 15 of the MAC service flags is set, multiple TransferDatas
  2197. may be called during a single ReceiveLookahead indication.  If
  2198. this bit is reset, only one TransferData per ReceiveLookahead
  2199. indication is permitted.  In the latter case subsequent calls
  2200. within the same indication will return an error.
  2201.  
  2202. For MACs with bit 15 of the MAC service flags reset, a protocol
  2203. intending to call TransferData must do so only if it has decided
  2204. to accept the incoming packet.  Since the MAC driver may be
  2205. shared by multiple protocols, a protocol's failure to follow this
  2206. restriction in this case jeopardizes other coexisting protocol
  2207. drivers from receiving these packets.  When a protocol is bound
  2208. to a MAC with  bit 15 set, this restriction does not apply as a
  2209. mandatory requirement.  However, it is still recommended in such
  2210. cases for performance reasons that a protocol call TransferData
  2211. only if it has decided to accept the incoming packet.  A protocol
  2212. module must set the Lookahead size large enough to determine if
  2213. the packet is intended for it by examining ony the Lookahead
  2214. bytes presented by ReceiveLookahead.
  2215.  
  2216. It is recommended that the multiple TransferData feature with bit
  2217. 15 set be implemented in MAC drivers whenever it is reasonable to
  2218. do so with the adapter hardware.
  2219.  
  2220.  
  2221. IndicationComplete
  2222.  
  2223. Purpose:  Allow protocol to do post-processing on indications.
  2224.  
  2225. PUSH WORD    MACID     ;Module ID of MAC
  2226. PUSH WORD    ProtDS    ;DS of called protocol module
  2227. CALL  IndicationComplete
  2228.  
  2229. Returns:    0x0000    SUCCESS
  2230.             0x0007    INVALID_PARAMETER
  2231.             0x00FF    GENERAL_FAILURE
  2232.  
  2233. Description:
  2234.  
  2235. A MAC calls this entry point to enable a protocol to do post-
  2236. processing after an indication.  The MAC will always generate an
  2237. IndicationComplete subsequent to an indication regardless of the
  2238. return code of the indication.  Although still in interrupt
  2239. context and subject to the normal OS/2 guidelines for interrupt
  2240. processing, the protocol is not under the severe time constraints
  2241. of the indication.  The MAC must minimize stack usage before
  2242. calling this routine and, under DOS, must have swapped off of any
  2243. special "interrupt" stack.
  2244.  
  2245. This routine is always entered with interrupts enabled and with
  2246. the network adapter interrupt dismissed from the interrupt
  2247. controller.  Therefore, it may be reentered at the completion of
  2248. another indication.  Also no one-to-one correspondence is
  2249. guaranteed between indications and IndicationComplete.  A MAC may
  2250. generate one IndicationComplete for several indications.  A
  2251. protocol may enforce a one-to-one correspondence by leaving
  2252. indications disabled until the return from IndicationComplete.
  2253.  
  2254. If indications are explicitly disabled by a protocol on return
  2255. from an indication, it is the protocol's responsibility to invoke
  2256. IndicationOn as soon possible during IndicationComplete.
  2257.  
  2258. MAC developers must avoid simply serializing each indication with
  2259. IndicationComplete as this can negatively affect performance.
  2260. The MAC must be designed to allow an indication to occur during
  2261. IndicationComplete processing.  Of course, if this occurs,
  2262. another IndicationComplete call will be necessary.
  2263.  
  2264.  
  2265. ReceiveChain
  2266.  
  2267. Purpose:  Indicate reception of a frame in MAC-managed buffers.
  2268.  
  2269. PUSH WORD     MACID        ;Module ID of MAC
  2270. PUSH WORD     FrameSize    ;Total size of frame (bytes)
  2271. PUSH WORD     ReqHandle    ;Unique handle for this request
  2272. PUSH LPBUF    RxBufDescr   ;Virtual address of receive descriptor
  2273. PUSH LPBYTE   Indicate     ;Virtual address of indicate flag
  2274. PUSH WORD     ProtDS       ;DS of called protocol module
  2275. CALL  ReceiveChain
  2276.  
  2277. Returns:    0x0000    SUCCESS
  2278.             0x0001    WAIT_FOR_RELEASE
  2279.             0x0003    FRAME_NOT_RECOGNIZED
  2280.             0x0004    FRAME_REJECTED
  2281.             0x0005    FORWARD_FRAME
  2282.             0x0006    OUT_OF_RESOURCE
  2283.             0x0007    INVALID_PARAMETER
  2284.             0x00FF    GENERAL_FAILURE
  2285.  
  2286. FrameSize   Total size of received frame, in bytes.
  2287.  
  2288. RxBufDescr  Virtual address of receive descriptor describing the
  2289.             received frame.
  2290.  
  2291. Indicate    Virtual address of indication flag byte.  This byte
  2292.             is set to 0xFF by the MAC prior to this call.  If the
  2293.             protocol clears the byte to zero prior to returning
  2294.             then indications will be left disabled until
  2295.             IndicationOn is called from IndicationComplete.
  2296.  
  2297. Description:
  2298.  
  2299. A MAC calls this routine to indicate the reception of a frame in
  2300. MAC-managed storage.  Ownership of this storage is implicitly
  2301. passed to the protocol when this call is made.  At its option,
  2302. the protocol may copy the data right away and indicate this via
  2303. the return code (in which case ownership reverts to the MAC); or
  2304. the protocol may queue the request and copy the frame later, in
  2305. which case it retains ownership of the frame's storage until it
  2306. calls ReceiveRelease.  Since the protocol may queue data received
  2307. in this manner, it is possible that the MAC may run low on
  2308. available frame buffers.  The MAC may elect to call
  2309. ReceiveLookahead instead of ReceiveChain while it is low on frame
  2310. buffers.  This allows the MAC to retain control of its remaining
  2311. buffers until the protocol releases the buffers it is holding.
  2312.  
  2313. Note that for frames longer than 256 bytes, the MAC must
  2314. guarantee that the first data block of the frame is at least 256
  2315. bytes long.  Frames less than or equal to 256 bytes in length
  2316. must be completely specified with a single data block.  This
  2317. allows the protocol to parse packet headers out of the first data
  2318. block and greatly facilitates protocol processing efficiency.
  2319.  
  2320. Like ReceiveLookahead, a protocol's processing within
  2321. ReceiveChain is time critical.  At some point after return from
  2322. ReceiveChain the MAC will generate an IndicationComplete to allow
  2323. post-processing of the indication.
  2324.  
  2325. The MAC implicitly disables indications (IndicationOff) before
  2326. calling ReceiveChain.   The Indicate flag byte instructs the MAC
  2327. on whether to reenable indications or leave then disable on the
  2328. return.  If the protocol chooses to leave indications disabled,
  2329. it can enable them within IndicationComplete by calling
  2330. IndicationOn.
  2331.  
  2332.  
  2333. ReceiveRelease
  2334.  
  2335. Purpose:  Return frame storage to the MAC that owns it.
  2336.  
  2337. PUSH WORD      ReqHandle  ;Unique handle from ReceiveChain
  2338. PUSH WORD      MACDS      ;DS of called MAC module
  2339. CALL  ReceiveRelease
  2340.  
  2341. Returns:    0x0000    SUCCESS
  2342.             0x0007    INVALID_PARAMETER
  2343.             0x0009    NOT_SUPPORTED
  2344.             0x00FF    GENERAL_FAILURE
  2345.  
  2346. Description:
  2347.  
  2348. A protocol uses this call after it has copied frame data provided
  2349. by a ReceiveChain call.  ReceiveRelease returns ownership of the
  2350. frame data blocks to the MAC.
  2351.  
  2352.  
  2353. IndicationOff
  2354.  
  2355. Purpose:  Disable MAC indications
  2356.  
  2357. PUSH WORD     MACDS     ;DS of called MAC module
  2358. CALL IndicationOff
  2359.  
  2360. Returns:    0x0000    SUCCESS
  2361.             0x0008    INVALID_FUNCTION
  2362.             0x00FF    GENERAL_FAILURE
  2363.  
  2364. Description:
  2365. A protocol may use this call to prevent the generation of
  2366. ReceiveLookahead, ReceiveChain and Status indications from the
  2367. MAC.  This is similar in concept to disabling interrupts.  When
  2368. indications are off, a MAC must queue events that would cause it
  2369. to generate indications to the protocol.  A MAC implicitly
  2370. disables indications just before calling the ReceiveLookahead,
  2371. ReceiveChain or Status indication entry point of a protocol.
  2372.  
  2373. The only legal use of IndicationOff is to bracket a call or calls
  2374. to the MAC.  For example, the following sequence is valid:
  2375.  
  2376. IndicationOff
  2377. TransmitChain
  2378. IndicationOn
  2379.  
  2380. In this situation the protocol must not block while indications
  2381. are off and must call IndicationOn as soon as possible.  The
  2382. protocol must ensure that all calls to IndicationOff are paired
  2383. up with a corresponding call to IndicationOn.  If the protocol
  2384. issues an IndicationOff call from a timer tick handler, or from a
  2385. ReceiveLookahead, ReceiveChain or Status indication handler it
  2386. must issue the IndicationOn call before returning.
  2387.  
  2388. Note that IndicationComplete may still occur even though
  2389. indications are disabled.  Disabling indications has no effect on
  2390. a MAC's ability to call IndicationComplete.
  2391.  
  2392. This function always returns with interrupts disabled.  It is the
  2393. responsibility of the caller to re-enable them.
  2394.  
  2395.  
  2396. IndicationOn
  2397.  
  2398. Purpose:  Enable MAC indications
  2399.  
  2400. Called from protocol to MAC.
  2401.  
  2402. PUSH WORD     MACDS     ;DS of called MAC module
  2403. CALL IndicationOn
  2404.  
  2405. Returns:    0x0000    SUCCESS
  2406.             0x0008    INVALID_FUNCTION
  2407.             0x00FF    GENERAL_FAILURE
  2408.  
  2409. Description:
  2410.  
  2411. A protocol must use this call to re-enable indications after
  2412. having disabled them.  Note that a MAC may optionally defer the
  2413. actual re-enabling of indications.
  2414.  
  2415. It is possible that IndicationOff and IndicationOn pairs will
  2416. nest.  Therefore the MAC must maintain a reference count to
  2417. enable it to determine when to actually re-enable indications.
  2418. The protocol must not assume that a call to IndicationOn will
  2419. immediately enable indications.
  2420.  
  2421. IndicationOn may be called from an IndicationComplete handler
  2422. after leaving indications disabled on return from an indication
  2423. handler.  IndicationOn may also be used, paired with
  2424. IndicationOff, to bracket a call or calls to the MAC.
  2425.  
  2426. This function always returns with interrupts disabled.  It is the
  2427. responsibility of the caller to re-enable them.  No indications
  2428. will be generated until after the call has returned.
  2429.  
  2430. General Requests
  2431.  
  2432. General requests are commands from a protocol to a MAC directing
  2433. it to do adapter management operations like setting the station
  2434. address, running diagnostics, and changing operating parameters
  2435. or modes.  A MAC may choose to implement any of the Request
  2436. functions synchronously or asynchronously.  A MAC returns the
  2437. REQUEST_QUEUED return code to inform the protocol that a given
  2438. request will be processed asynchronously.  When this is the case,
  2439. the MAC will call back to the protocol's RequestConfirm entry
  2440. point to indicate when processing of the request is complete.  If
  2441. a request handle of zero is used then the RequestConfirm call is
  2442. suppressed.  It is the caller's responsibility to make certain
  2443. that any data referenced by the request remains valid until the
  2444. request is guaranteed to have completed.  If a protocol makes a
  2445. general MAC request when executing its InitiateBind startup
  2446. function and the MAC returns REQUEST_QUEUED, the protocol must
  2447. wait for the corresponding RequestConfirm to be returned before
  2448. exiting from the InitiateBind function.  Any other return code
  2449. from a general request implies that no RequestConfirm will occur.
  2450.  
  2451. All general requests have the following common calling convention:
  2452.  
  2453. PUSH WORD     ProtID      ;Module ID of Protocol or 0
  2454. PUSH WORD     ReqHandle   ;Unique handle for this request or 0
  2455. PUSH WORD     Param1      ;Request dependent word parameter or 0
  2456. PUSH DWORD    Param2      ;Request dependent dword parameter or 0
  2457. PUSH WORD     Opcode      ;Opcode of request
  2458. PUSH WORD     MACDS       ;DS of called MAC module
  2459. Call Request
  2460.  
  2461.  
  2462. InitiateDiagnostics
  2463.  
  2464. Purpose:  Start runtime diagnostics.
  2465.  
  2466. PUSH WORD     ProtID    ; Module ID of Protocol
  2467. PUSH WORD     ReqHandle ; Unique handle for this request or 0
  2468. PUSH WORD     0         ; Pad parameter - must be 0
  2469. PUSH DWORD    0         ; Pad parameter - must be 0
  2470. PUSH WORD     1         ; Initiate Diagnostics Request
  2471. PUSH WORD     MACDS     ; DS of called MAC module
  2472. Call Request
  2473.  
  2474. Returns:  0x0000    SUCCESS
  2475.           0x0002    REQUEST_QUEUED
  2476.           0x0006    OUT_OF_RESOURCE
  2477.           0x0007    INVALID_PARAMETER
  2478.           0x0008    INVALID_FUNCTION
  2479.           0x0009    NOT_SUPPORTED
  2480.           0x000A    HARDWARE_ERROR
  2481.           0x00FF    GENERAL_FAILURE
  2482.  
  2483. Description:
  2484.  
  2485. Causes a MAC to run hardware diagnostics and update its status
  2486. information in the MAC-specific status section of the
  2487. characteristics table.  A MAC must return an error if it does not
  2488. support run time diagnostics.  While the diagnostics are in
  2489. progress, the MAC must set the diagnostics in progress bit (bit
  2490. 5) in the MAC status field in the MAC service-specific status
  2491. table.  If HARDWARE_ERROR is returned, the protocol may examine
  2492. the various fields in the service-specific status table for an
  2493. indication as to the cause of the problem.
  2494.  
  2495. ReadErrorLog
  2496.  
  2497. Purpose:  Return error log.
  2498.  
  2499. PUSH WORD     ProtID    ; Module ID of Protocol
  2500. PUSH WORD     ReqHandle ; Unique handle for this request or 0
  2501. PUSH WORD     LogLen    ; Length of log buffer
  2502. PUSH LPBUF    LogAddr   ; Buffer for returning log
  2503. PUSH WORD     2         ; Read Error Log Request
  2504. PUSH WORD     MACDS     ; DS of called MAC module
  2505. Call Request
  2506.  
  2507. Returns:    0x0000    SUCCESS
  2508.             0x0002    REQUEST_QUEUED
  2509.             0x0006    OUT_OF_RESOURCE
  2510.             0x0007    INVALID_PARAMETER
  2511.             0x0008    INVALID_FUNCTION
  2512.             0x0009    NOT_SUPPORTED
  2513.             0x00FF    GENERAL_FAILURE
  2514.  
  2515. Description:
  2516.  
  2517. Causes a read error log to be issued to adapter.  This command is
  2518. implemented on the IBM token ring adapter and possibly other
  2519. adapters.  The format of the information returned is adapter
  2520. specific and not specified here.
  2521.  
  2522.  
  2523. SetStationAddress
  2524.  
  2525. Purpose:  Set the network address of the station.
  2526.  
  2527. PUSH WORD     ProtID     ; Module ID of Protocol
  2528. PUSH WORD     ReqHandle  ; Unique handle for this request or 0
  2529. PUSH WORD     0          ; Pad parameter - must be 0
  2530. PUSH LPBUF    AdaptAddr  ; Buffer containing the adapter address
  2531. PUSH WORD     3          ; SetStationAddress Request
  2532. PUSH WORD     MACDS      ; DS of called MAC module
  2533. Call Request
  2534.  
  2535. Returns:  0x0000    SUCCESS
  2536.           0x0002    REQUEST_QUEUED
  2537.           0x0006    OUT_OF_RESOURCE
  2538.           0x0007    INVALID_PARAMETER
  2539.           0x0008    INVALID_FUNCTION
  2540.           0x0009    NOT_SUPPORTED
  2541.           0x00FF    GENERAL_FAILURE
  2542.  
  2543. Description:
  2544.  
  2545. There is only a single station address.  Each time it replaces
  2546. the current station address in the MAC service-specific
  2547. characteristics table and will reconfigure the hardware to
  2548. receive on that address if required.  The station will be
  2549. initially configured with the address specified in the permanent
  2550. station address field of the MAC service-specific characteristics
  2551. table (which this call does not modify).
  2552.  
  2553. The adapter address buffer contains only the bytes of the address
  2554. to be set.  The length of the address must be equal to the length
  2555. specified in the MAC service characteristics table.
  2556.  
  2557. If the hardware does not support a mechanism to modify its
  2558. station address then the current station address buffer is not
  2559. updated and this function returns INVALID_FUNCTION.  In this case
  2560. the MAC continues to use the permanent station address to
  2561. recognize incoming directed packets.
  2562.  
  2563. If a MAC does not support the OpenAdapter and CloseAdapter
  2564. commands (bit 11 of the MAC service flags is reset), then the
  2565. SetStationAddress command can be issued by the protocol at any
  2566. time.  However, if the MAC supports the Open Adapter and
  2567. CloseAdapter commands (bit 11 of the MAC service flags is set),
  2568. then this command is valid only either during system
  2569. initialization time or while the MAC is in a closed state.  The
  2570. protocol driver must issue an Open Adapter call after issuing the
  2571. SetStationAddress call for the SetStationAddress command to take
  2572. effect.
  2573.  
  2574.  
  2575. OpenAdapter
  2576.  
  2577. Purpose:  Issue open request to network adapter.
  2578.  
  2579. PUSH WORD     ProtID         ; Module ID of Protocol
  2580. PUSH WORD     ReqHandle      ; Unique handle for this request or 0
  2581. PUSH WORD     OpenOptions    ; Adapter specific open options
  2582. PUSH DWORD    ExtendedRet    ; Optional pointer to a DWORD extended
  2583.                                return code
  2584.                                (vendor-specific or warning level)
  2585. PUSH WORD     4              ; Open Adapter Request
  2586. PUSH WORD     MACDS          ; DS of called MAC module
  2587. Call Request
  2588.  
  2589. Returns:    0x0000    SUCCESS
  2590.             0x0002    REQUEST_QUEUED
  2591.             0x0006    OUT_OF_RESOURCE
  2592.             0x0007    INVALID_PARAMETER
  2593.             0x0008    INVALID_FUNCTION
  2594.             0x0009    NOT_SUPPORTED
  2595.             0x0024    HARDWARE_FAILURE
  2596.             0x002A    NETWORK_MAY_NOT_BE_CONNECTED
  2597.             0x00FF    GENERAL_FAILURE
  2598.  
  2599.  
  2600. Where:
  2601.  
  2602. Optional vendor-specific information can be returned through the 
  2603. ExtendedRet pointer. A caller supporting this would push a pointer to a 
  2604. DWORD. The DWORD would have been initialized to 0xFFFFFFFF (unsupported).
  2605. If there is any extended return information this value would be changed. 
  2606. A caller not supporting this would simply push a NULL (0) pointer. The
  2607. OpenAdapter routine which supports this would verify the ExtendedRet
  2608. pointer is not NULL (0) and then write the information. The OpenAdapter
  2609. routine which does not support this would simply ignore the pointer.
  2610.  
  2611. The purpose of ExtendedRet is to provide warning messages on a
  2612. SUCCESS return without requiring additional testing for those callers
  2613. not supporting warnings, to provide additional information on
  2614. GENERAL_FAILURE  and HARDWARE_FAILURE, and to pass vendor-specific codes
  2615. on any return to provide for active functional experimentation and
  2616. evolution without inconveniencing other vendor's components.
  2617.  
  2618. Description:
  2619.  
  2620. The purpose of the OpenAdapter function is to activate an
  2621. adapter's network connection.  This may involve making an
  2622. electrical connection for some adapters like token ring adapters.
  2623. This also implies that a considerable delay may occur between
  2624. submittal of this request and its confirmation.  If the MAC
  2625. indicates that OpenAdapter is supported (by setting bit 11 of the
  2626. service flags in the MAC service-specific characteristics table),
  2627. then the protocol driver must ensure the adapter is open during
  2628. bind-time processing.  Since OpenAdapter can only be called when
  2629. the adapter is closed, even in a VECTOR configuration, the
  2630. protocol must first check if the adapter is already open by
  2631. examining bit 4 of the MAC status in the MAC service-specific
  2632. status table.
  2633.  
  2634. While an adapter is closed the following functions are guaranteed
  2635. to operate:  SetLookahead, SetPacketFilter, SetStationAddress,
  2636. Interrupt, Indicationoff, IndicationOn.
  2637.  
  2638. Since this function is adapter specific it is expected that any
  2639. necessary parameters are either known a priori by the MAC or can
  2640. be recovered from the PROTOCOL.INI file.  The format of the
  2641. information is highly adapter specific and left up to the
  2642. implementer to define.
  2643.  
  2644. The OpenOptions parameter is adapter specific.  For IBM TokenRing
  2645. and compatible adapters, these are defined in the IBM Token Ring
  2646. Technical Reference Manual.
  2647.  
  2648.  
  2649. CloseAdapter
  2650.  
  2651. Purpose:  Issue close request to network adapter.
  2652.  
  2653. PUSH WORD     ProtID      ; Module ID of Protocol
  2654. PUSH WORD     ReqHandle   ; Unique handle for this request or 0
  2655. PUSH WORD     0           ; Pad parameter - must be 0
  2656. PUSH DWORD    0           ; Pad parameter - must be 0
  2657. PUSH WORD     5           ; Close Adapter Request
  2658. PUSH WORD     MACDS       ; DS of called MAC module
  2659. Call  Request
  2660.  
  2661. Returns:    0x0000    SUCCESS
  2662.             0x0002    REQUEST_QUEUED
  2663.             0x0006    OUT_OF_RESOURCE
  2664.             0x0007    INVALID_PARAMETER
  2665.             0x0008    INVALID_FUNCTION
  2666.             0x0009    NOT_SUPPORTED
  2667.             0x00FF    GENERAL_FAILURE
  2668.  
  2669. Description:
  2670.  
  2671. This function closes an adapter.  This causes it to decouple
  2672. itself from a network so that packets cannot be sent or received.
  2673. CloseAdapter resets the functional or multicast addresses
  2674. currently set.
  2675.  
  2676. Since this function is adapter specific it is expected that any
  2677. necessary parameters are either already known by the MAC or can
  2678. be recovered from the PROTOCOL.INI file.  The format of the
  2679. information is highly adapter specific and left up to the
  2680. implementer to define.
  2681.  
  2682.  
  2683. ResetMAC
  2684.  
  2685. Purpose:  Reset the MAC software and adapter hardware.
  2686.  
  2687. PUSH WORD     ProtID      ; Module ID of Protocol
  2688. PUSH WORD     ReqHandle   ; Unique handle for this request or 0
  2689. PUSH WORD     0           ; Pad parameter - must be 0
  2690. PUSH DWORD    0           ; Pad parameter - must be 0
  2691. PUSH WORD     6           ; Reset MAC Request
  2692. PUSH WORD     MACDS       ; DS of called MAC module
  2693. Call Request
  2694.  
  2695. Returns:    0x0000    SUCCESS
  2696.             0x0006    OUT_OF_RESOURCE
  2697.             0x0007    INVALID_PARAMETER
  2698.             0x0008    INVALID_FUNCTION
  2699.             0x0009    NOT_SUPPORTED
  2700.             0x0024    HARDWARE FAILURE
  2701.             0x002A    NETWORK_MAY_NOT_BE_CONNECTED       
  2702.             0x00FF    GENERAL_FAILURE
  2703.  
  2704. Description:
  2705.  
  2706. The function causes the MAC to issue a hardware reset to the
  2707. network adapter.  The MAC may discard without confirmation any
  2708. pending requests and abort operations in progress.  For
  2709. compatibility with some current protocols which do not properly
  2710. handle resets, it is suggested the MAC complete pending requests,
  2711. returning INVALID_FUNCTION on all confirmations which result.  The
  2712. MAC must preserve the current station address, LOOKAHEAD length,
  2713. packet filter, multicast address list, functional address and
  2714. indication on/off state.
  2715.  
  2716. For MAC's that support the OpenAdapter function, the Reset MAC
  2717. command leaves the adapter in the opened state if it was opened
  2718. prior to the reset.  The adapter open parameters that were in
  2719. effect prior to the reset must be the same ones in effect after
  2720. the reset.
  2721.  
  2722. When the reset is initiated, the MAC must generate a StartReset
  2723. status indication back to the protocol.  For some MAC's a
  2724. considerable delay can elapse between the start of the reset and
  2725. its completion.  All MAC's must subsequently issue an EndReset
  2726. indication when the reset is complete.  During the time between
  2727. the StartReset indication and the corresponding EndReset
  2728. indication, the MAC must return INVALID_FUNCTION for any request
  2729. it receives  while a reset is in progress. The EndReset indication
  2730. notifies the protocol that the MAC can handle new requests.
  2731. As always, an IndicationComplete follows these indications. 
  2732. MACSs written to V1.0.1. of this spec will not issue the
  2733. End Reset. They must issue the IndicationCompleteto signal
  2734. the end of the reset.
  2735.  
  2736. Note that the completion (i.e. the return from this command or
  2737. the request confirm) of the Reset MAC request itself does not
  2738. signal the start or end of the reset.
  2739.  
  2740. There can be no guarantee that this function will succeed, though
  2741. the NDIS MAC developer must make every attempt.  An error return
  2742. from this call can be considered fatal. If the reset fails, 
  2743. the adapter may no longer be in the same state. For example, if the
  2744. adapter was open before a failed ResetMAC, it may now be closed.
  2745.  
  2746.  
  2747. SetPacketFilter
  2748.  
  2749. Purpose:  Select received packet general filtering parameters.
  2750.  
  2751. PUSH WORD     ProtID      ; Module ID of Protocol
  2752. PUSH WORD     ReqHandle   ; Unique handle for this request or 0
  2753. PUSH WORD     FilterMask  ; Bit mask for packet filter
  2754. PUSH DWORD    0           ; Pad parameter - must be 0
  2755. PUSH WORD     7           ; Set Packet Filter Request
  2756. PUSH WORD     MACDS       ; DS of called MAC module
  2757. Call Request
  2758.  
  2759. FilterMask  bit
  2760.      0 directed and multicast or group and functional
  2761.      1 broadcast packets
  2762.      2 any packet on LAN (promiscuous)
  2763.      3 any source routing packet on LAN
  2764.      4-15 Reserved, must be zero
  2765.  
  2766. Returns:    0x0000    SUCCESS
  2767.             0x0002    REQUEST_QUEUED
  2768.             0x0006    OUT_OF_RESOURCE
  2769.             0x0007    INVALID_PARAMETER
  2770.             0x0008    INVALID_FUNCTION
  2771.             0x00FF    GENERAL_FAILURE
  2772.  
  2773. Description:
  2774.  
  2775. This command tells the MAC which kinds of received packets must
  2776. generate indications to the protocol invoking this command.  A
  2777. FilterMask of 0 indicates that the MAC must not indicate received
  2778. packets to that protocol.  If a FilterMask bit is set, then this
  2779. indicates that the MAC must indicate that type of packet to the
  2780. protocol.  Except for a 0 FilterMask, a filter bit of 0 does not
  2781. require the MAC to suppress indications for that type of packet.
  2782. For example the FilterMask used by the MAC may or may not
  2783. correspond to the capabilities of the hardware adapter.  For
  2784. example a MAC may be designed to receive multicast frames by
  2785. promiscuously receiving all frames and discarding those that do
  2786. not match the filter.  It is optional for the MAC to support such
  2787. software filtering.  If the MAC can suppress such indications, it
  2788. is strongly recommended that it do so.  However, if the MAC does
  2789. not suppress such indications, then the protocol must be prepared
  2790. to receive these and discard the incoming packet if necessary.
  2791.  
  2792. If this request returns SUCCESS, then the hardware is enabled to
  2793. receive the types of packets requested and will generate
  2794. Indications to the protocol for those types of packets.
  2795.  
  2796. If the MAC does not support the receiving of packets of the type
  2797. specified, then it will return GENERAL_FAILURE.  In this case the
  2798. FilterMask is left in its previous state.
  2799.  
  2800.  
  2801. AddMulticastAddress
  2802.  
  2803. Purpose:  Allow adapter to respond to a multicast address.
  2804.  
  2805. PUSH WORD     ProtID      ; Module ID of Protocol
  2806. PUSH WORD     ReqHandle   ; Unique handle for this request or 0
  2807. PUSH WORD     0           ; Pad parameter - must be 0
  2808. PUSH LPBUF    MultiAddr   ; Buffer containing multicast address
  2809. PUSH WORD     8           ; Add Multicast Address Request
  2810. PUSH WORD     MACDS       ; DS of called MAC module
  2811. Call Request
  2812.  
  2813. Returns:    0x0000    SUCCESS
  2814.             0x0002    REQUEST_QUEUED
  2815.             0x0006    OUT_OF_RESOURCE
  2816.             0x0007    INVALID_PARAMETER
  2817.             0x0008    INVALID_FUNCTION
  2818.             0x0009    NOT_SUPPORTED
  2819.             0x00FF    GENERAL_FAILURE
  2820.  
  2821. Description:
  2822.  
  2823. This function allows the addition of multicast addresses.  The
  2824. term multicast address also implies 802.5 group addresses.  This
  2825. function allows the addition of only one address at a time but
  2826. can be repeated to add more multicasts.
  2827.  
  2828. It is the MAC's responsibility to return an error if too many
  2829. multicast addresses have been added (OUT_OF_RESOURCE or
  2830. INVALID_FUNCTION) or if an address of the wrong type has been
  2831. added (INVALID_PARAMETER).
  2832.  
  2833. Multicast addresses are never over written and will return an
  2834. error (INVALID_PARAMETER) if they already exist no matter what
  2835. their type.  They must be explicitly deleted.
  2836.  
  2837. The multicast address buffer contains only the bytes of the
  2838. multicast address to be added.  The length of the multicast
  2839. address must be equal to the length specified in the MAC service
  2840. characteristics table.
  2841.  
  2842.  
  2843. DeleteMulticastAddress
  2844.  
  2845. Purpose:  Forbid adapter to respond to a multicast address.
  2846.  
  2847. PUSH WORD     ProtID    ; Module ID of Protocol
  2848. PUSH WORD     ReqHandle ; Unique handle for this request or 0
  2849. PUSH WORD     0         ; Pad parameter - must be 0
  2850. PUSH LPBUF    MultiAddr ; Buffer containing multicast address
  2851. PUSH WORD     9         ; Delete Multicast Address Request
  2852. PUSH WORD     MACDS     ; DS of called MAC module
  2853. Call Request
  2854.  
  2855. Returns:    0x0000    SUCCESS
  2856.             0x0002    REQUEST_QUEUED
  2857.             0x0006    OUT_OF_RESOURCE
  2858.             0x0007    INVALID_PARAMETER
  2859.             0x0008    INVALID_FUNCTION
  2860.             0x0009    NOT_SUPPORTED
  2861.             0x00FF    GENERAL_FAILURE
  2862.  
  2863. Description:
  2864.  
  2865. This function removes a previously added multicast address.  The
  2866. term multicast address also implies 802.5 group addresses.
  2867. INVALID_PARAMETER is returned if the address was not in the
  2868. table.
  2869.  
  2870. The multicast address buffer has the same format as in the
  2871. AddMulticastAddress command.
  2872.  
  2873.  
  2874. UpdateStatistics
  2875.  
  2876. Purpose:  Cause MAC statistics to be updated.
  2877.  
  2878. PUSH WORD     ProtID    ; Module ID of Protocol
  2879. PUSH WORD     ReqHandle ; Unique handle for this request or 0
  2880. PUSH WORD     0         ; Pad parameter - must be 0
  2881. PUSH DWORD    0         ; Pad parameter - must be 0
  2882. PUSH WORD     10        ; Update Statistics request
  2883. PUSH WORD     MACDS     ; DS of called MAC module
  2884. Call Request
  2885.  
  2886. Returns:    0x0000    SUCCESS
  2887.             0x0002    REQUEST_QUEUED
  2888.             0x0006    OUT_OF_RESOURCE
  2889.             0x0007    INVALID_PARAMETER
  2890.             0x0008    INVALID_FUNCTION
  2891.             0x00FF    GENERAL_FAILURE
  2892.  
  2893. Description:
  2894.  
  2895. Causes the MAC to atomically update the statistics in its
  2896. characteristics table.  The requester can then read that table
  2897. when this operation is complete. Those statistics which are not
  2898. always current will remain the same until the next UpdateStatistics
  2899. call is performed. If all of the statistics in the table are
  2900. always current this function must return SUCCESS.
  2901.  
  2902.  
  2903. ClearStatistics
  2904.  
  2905. Purpose:  Cause MAC statistics to be cleared.
  2906.  
  2907. PUSH WORD     ProtID      ; Module ID of Protocol
  2908. PUSH WORD     ReqHandle   ; Unique handle for this request or 0
  2909. PUSH WORD     0           ; Pad parameter - must be 0
  2910. PUSH DWORD    0           ; Pad parameter - must be 0
  2911. PUSH WORD     11          ; Clear Statistics request
  2912. PUSH WORD     MACDS       ; DS of called MAC module
  2913. Call Request
  2914.  
  2915. Returns:    0x0000    SUCCESS
  2916.             0x0002    REQUEST_QUEUED
  2917.             0x0006    OUT_OF_RESOURCE
  2918.             0x0007    INVALID_PARAMETER
  2919.             0x0008    INVALID_FUNCTION
  2920.             0x00FF    GENERAL_FAILURE
  2921.  
  2922.  
  2923. Description:
  2924.  
  2925. Causes the MAC to reset its statistics counters.  This implies
  2926. that all statistics must be reset to zero in an atomic operation.
  2927.  
  2928.  
  2929. InterruptRequest
  2930.  
  2931. Purpose:  Request asynchronous indication.
  2932.  
  2933. PUSH WORD     ProtID    ; Module ID of Protocol
  2934. PUSH WORD     0         ; Pad parameter - must be 0
  2935. PUSH WORD     0         ; Pad parameter - must be 0
  2936. PUSH DWORD    0         ; Pad parameter - must be 0
  2937. PUSH WORD     12        ; InterruptRequest
  2938. PUSH WORD     MACDS     ; DS of called MAC module
  2939. Call Request
  2940.  
  2941. Returns:    0x0000    SUCCESS
  2942.             0x0006    OUT_OF_RESOURCE
  2943.             0x0008    INVALID_FUNCTION
  2944.             0x0009    NOT_SUPPORTED
  2945.             0x00FF    GENERAL_FAILURE
  2946.  
  2947. Description:
  2948.  
  2949. This function requests the MAC to generate an asynchronous
  2950. Interrupt Status indication back to the protocol.  The protocol
  2951. may control the generation of this Interrupt Status indication by
  2952. disabling and later enabling indications.  The MAC may at its
  2953. discretion suppress the generation of this indication if there is
  2954. another indication pending which may be issued in place of the
  2955. Interrupt status indication.  This request is intended to be used
  2956. for MAC's which can generate a hardware interrupt on demand.
  2957. This function must be implemented if at all possible.  Interrupt
  2958. request will substantially improve the performance of some
  2959. protocols (particularly DLC).
  2960.  
  2961.  
  2962. SetFunctionalAddress
  2963.  
  2964. Purpose:  Cause adapter to change its functional address.
  2965.  
  2966. PUSH WORD     ProtID     ; Module ID of Protocol
  2967. PUSH WORD     ReqHandle  ; Unique handle for this request or 0
  2968. PUSH WORD     0          ; Pad parameter - must be 0
  2969. PUSH LPBUF    FunctAddr  ; Buffer containing functional address
  2970. PUSH WORD     13         ; Set Functional Address Request
  2971. PUSH WORD     MACDS      ; DS of called MAC module
  2972. Call Request
  2973.  
  2974.  
  2975. Returns:    0x0000    SUCCESS
  2976.             0x0002    REQUEST_QUEUED
  2977.             0x0006    OUT_OF_RESOURCE
  2978.             0x0007    INVALID_PARAMETER
  2979.             0x0008    INVALID_FUNCTION
  2980.             0x0009    NOT_SUPPORTED
  2981.             0x00FF    GENERAL_FAILURE
  2982.  
  2983. Description:
  2984.  
  2985. This sets the IEEE802.5 functional address to the passed
  2986. functional address.  The adapter will use the functional address
  2987. to discern packets intended for it.  For more information on
  2988. functional addresses see the IEEE 802.5 specification.
  2989.  
  2990. The functional address buffer contains only the bytes of the new
  2991. functional address bit pattern. It represents the logical OR of
  2992. all functional addresses to be registered with the adapter.  The
  2993. length of the functional address buffer is 4 bytes.
  2994.  
  2995. Multiple protocols can set or reset their functional address bit
  2996. if required by each protocol by first reading the current
  2997. functional address DWORD bit pattern from the MAC service
  2998. characteristics table, then ORing in or ANDing out the required
  2999. functional bit and passing the new functional address pattern in
  3000. this command.
  3001.  
  3002.  
  3003. SetLookahead
  3004.  
  3005. Purpose:  Set length of lookahead information for ReceiveLookahead.
  3006.  
  3007. PUSH WORD     ProtID      ; Module ID of Protocol
  3008. PUSH WORD     ReqHandle   ; Unique handle for this request or 0
  3009. PUSH WORD     Length      ; Minimum length of lookahead info
  3010. PUSH DWORD    0           ; Pad parameter - must be 0
  3011. PUSH WORD     14          ; Set Lookahead Request
  3012. PUSH WORD     MACDS       ; DS of called MAC module
  3013.  
  3014. Call Request
  3015.  
  3016. Returns:    0x0000    SUCCESS
  3017.             0x0002    REQUEST_QUEUED
  3018.             0x0007    INVALID_PARAMETER
  3019.             0x00FF    GENERAL_FAILURE
  3020.  
  3021. Description:
  3022.  
  3023. This request sets the minimum length in bytes of lookahead
  3024. information to be returned in a Receive Lookahead indication.
  3025. Until SetLookahead is initially called, a value of 64 bytes is
  3026. assumed for the lookahead length.  When first called,
  3027. SetLookahead sets the lookahead length value equal to the Length
  3028. parameter of the request.  After the first SetLookahead request,
  3029. the lookahead length is changed only if the value of the Length
  3030. parameter is larger than the current lookahead length.  If the
  3031. length parameter value is smaller, the current Lookahead length
  3032. remains unchanged and SUCCESS is returned.  SetLookahead may be
  3033. called at any time and the lookahead length is preserved during a
  3034. reset.  The maximum value for the lookahead length is 256 bytes.
  3035. MAC's which never call Receive Lookahead or always return
  3036. lookahead information of length greater than or equal to 256
  3037. bytes may return SUCCESS without any internal action.  MAC's must
  3038. support 256 bytes of lookahead data if requested.
  3039.  
  3040.  
  3041. General Request Confirmation
  3042.  
  3043. Purpose: Confirm completion of a previous General Request.
  3044.  
  3045. PUSH WORD     ProtID      ; Module ID of Protocol
  3046. PUSH WORD     MACID       ; Module ID of MAC
  3047. PUSH WORD     ReqHandle   ; Unique handle of original request
  3048. PUSH WORD     Status      ; Final status of original request
  3049. PUSH WORD     Request     ; Original Request opcode
  3050. PUSH WORD     ProtDS      ; DS of called Protocol module
  3051. Call RequestConfirm
  3052.  
  3053. Returns:    0x0000    SUCCESS
  3054.             0x0006    OUT_OF_RESOURCE
  3055.             0x0007    INVALID_PARAMETER
  3056.             0X0024    HARDWARE_FAILURE
  3057.             0x00FF    GENERAL_FAILURE
  3058.  
  3059. Description:
  3060.  
  3061. Notify a protocol that an asynchronous MAC control Request has
  3062. completed after previous Request had returned a REQUEST_QUEUED.
  3063. It is possible that a RequestConfirm can be returned to the
  3064. protocol before the protocol's corresponding Request function has
  3065. completed.
  3066.  
  3067. The ProtID parameter must be the value passed by the protocol on
  3068. the previous general request to identify the requestor.
  3069.  
  3070. If a protocol had made a general MAC request when executing its
  3071. InitiateBind startup function and the MAC returned
  3072. REQUEST_QUEUED, the protocol must wait for the corresponding
  3073. RequestConfirm to be returned before exiting from the
  3074. InitiateBind function.
  3075.  
  3076. Status Indication
  3077.  
  3078. Status indications are spontaneous calls from a MAC to a
  3079. protocol, typically at interrupt time.  They inform the protocol
  3080. of changes in MAC status.
  3081.  
  3082. All status indications have the following common calling
  3083. convention:
  3084.  
  3085. PUSH WORD     MACID     ; Module ID of MAC
  3086. PUSH WORD     Param1    ; Opcode dependent word parameter or 0
  3087. PUSH LPBYTE   Indicate  ; Virtual address of indicate flag
  3088. PUSH WORD     Opcode    ; Opcode of status indication
  3089. PUSH WORD     ProtDS    ; DS of called Protocol module
  3090. Call Status
  3091.  
  3092. Indicate is the virtual address of the indication flag byte.
  3093. This byte is set to 0xFF by the MAC prior to this call.  If the
  3094. protocol clears the byte to zero prior to returning then
  3095. indications will be left disabled until IndicationOn is called
  3096. from IndicationComplete.
  3097.  
  3098.  
  3099. RingStatus
  3100.  
  3101. Purpose:  Return a change in ring status.
  3102.  
  3103. PUSH WORD     MACID     ; Module ID of MAC
  3104. PUSH WORD     Status    ; New Ring Status
  3105. PUSH LPBYTE   Indicate  ; Virtual address of indicate flag
  3106. PUSH WORD     1         ; Ring Status Indication
  3107. PUSH WORD     ProtDS    ; DS of called protocol module
  3108. Call Indication
  3109.  
  3110. Returns:  0x0000    SUCCESS
  3111.  
  3112. Description:
  3113.  
  3114. Called by 802.5-style MAC drivers to indicate a change in ring
  3115. status.  The status codes for 802.5-style drivers are encoded as
  3116. a 16-bit mask, where the bits in the mask are defined as follows:
  3117.  
  3118.   Bit             Meaning
  3119.  
  3120.   15              Signal Loss
  3121.   14              Hard Error
  3122.   13              Soft Error
  3123.   12              Transmit Beacon
  3124.   11              Lobe Wire Fault
  3125.   10              Auto-Removal Error 1
  3126.    9              Reserved
  3127.    8              Remove Received
  3128.    7              Counter Overflow
  3129.    6              Single Station
  3130.    5              Ring Recovery
  3131.    4-0            Reserved
  3132.  
  3133. For certain ring status changes, the adapter may already have
  3134. been removed from the ring.  The protocol driver must check
  3135. whether the adapter has been closed (by examining bit 4 fo the
  3136. MAC status field in the MAC service-specific status table).  For
  3137. additional information, consult the IBM Token Ring Technical
  3138. Reference Manual.  If the status condition caused the adapter to
  3139. close, the MAC must return confirmations with non-SUCCESS status
  3140. codes for all pending TransmitChain and general requests.
  3141.  
  3142.  
  3143. AdapterCheck
  3144.  
  3145. Purpose:  Return hardware status.
  3146.  
  3147. PUSH WORD       MACID     ; Module ID of MAC
  3148. PUSH WORD       Reason    ; Reason for Adapter Check
  3149. PUSH LPBYTE     Indicate  ; Virtual address of indicate flag
  3150. PUSH WORD       2         ; Adapter Check Indication
  3151. PUSH WORD       ProtDS    ; DS of called protocol module
  3152. Call Status
  3153.  
  3154. Returns:  0x0000    SUCCESS
  3155.  
  3156. Description:
  3157.  
  3158. Called to indicate a fatal adapter error.  If this function is
  3159. called the protocol must issue a ResetMAC call (if supported)
  3160. before communications can resume.  Note that a MAC may choose to
  3161. tolerate some number of errors before issuing an AdaperCheck
  3162. indication.  For example, a MAC may want to accept the occasional
  3163. receive DMA overrun, and only issue the AdapterCheck for this
  3164. condition if it occurs excessively.
  3165.  
  3166. For 802.5 MAC's the Reason code is defined as follows (NOT a bit
  3167. mask):
  3168.  
  3169.   0x8000  Adapter Inoperative
  3170.   0x1000  Illegal Opcode
  3171.   0x0800  Local Bus Parity Error
  3172.   0x0400  Parity Error
  3173.   0x0100  Internal Parity Error
  3174.   0x0080  Parity Error, Ring Transmit
  3175.   0x0040  Parity Error, Ring Receive
  3176.   0x0020  Transmit Overrun
  3177.   0x0010  Receive Overrun
  3178.   0x0008  Unrecognized Interrupt
  3179.   0x0004  Unrecognized Error Interrupt
  3180.   0x0003  Adapter Detected No PC System Service
  3181.   0x0002  Unrecognized Supervisory Request
  3182.   0x0001  Program Request
  3183.  
  3184. All 802.5 values not defined above are reserved.
  3185.  
  3186. The MAC must always return confirmations with non-SUCCESS status
  3187. codes for all pending TransmitChain and general requests.
  3188.  
  3189. For 802.3 MAC's the Reason code is defined as follows (NOT a bit mask):
  3190.  
  3191.   0x8000  Adapter Inoperative (Adapter did not respond
  3192.           to command or could not be found)
  3193.   0x4000  Command Timed Out (Adapter did not complete
  3194.           command within acceptable time interval)
  3195.   0x2000  SQE Test Failure (No heartbeat detected on
  3196.           previous transmission)
  3197.   0x1000  Excessive Collisions (Transmission failed due
  3198.           to excessive collisions)
  3199.   0x0800  Lost Carrier Sense (Adapter lost carrier
  3200.           during transmission)
  3201.   0x0400  TDR Failure (TDR test detected a short or
  3202.           open on the link)
  3203.   0x0020  Transmit Underrun (DMA underrun occurred on
  3204.           transmission)
  3205.   0x0010  Receive Overrun (DMA overrun occurred on reception)
  3206.  
  3207. All 802.3 values not defined above are reserved.
  3208.  
  3209.  
  3210. StartReset
  3211.  
  3212. Purpose:  Imply that adapter has started a reset.
  3213.  
  3214. PUSH WORD       MACID     ; Module ID of MAC
  3215. PUSH WORD       0         ; Pad parameter must be zero
  3216. PUSH LPBYTE     Indicate  ; Virtual address of indicate flag
  3217. PUSH WORD       3         ; Start Reset Indication
  3218. PUSH WORD       ProtDS    ; DS of called protocol module
  3219. Call Status
  3220.  
  3221. Returns:  0x0000    SUCCESS
  3222.  
  3223. Description:
  3224.  
  3225. Called to indicate that the adapter has started a reset.  This
  3226. will generally be due to a call to ResetMAC (perhaps by another
  3227. protocol driver in a VECTOR configuration) but can be
  3228. unsolicited.  The protocol must assume when it gets this
  3229. indication that all requests outstanding to the MAC have been
  3230. discarded without notification.  The end of the reset will be
  3231. signalled by an EndReset indication.  The reset process may take
  3232. a significant amount of time.  While it is in progress, the MAC
  3233. may reject any requests it cannot handle with INVALID_FUNCTION
  3234. (0x0008).  As with any other indication, StartReset is entered
  3235. with indications implicitly disabled.  To protect itself from
  3236. other indications the protocol may choose to modify the Indicate
  3237. flag to keep indications disabled on return.  This will not
  3238. prevent the EndReset indication from being generated however.
  3239.  
  3240. EndReset
  3241.  
  3242. Purpose:  Imply that adapter has finished a reset.
  3243.  
  3244. PUSH WORD       MACID     ; Module ID of MAC
  3245. PUSH WORD       Status    ; MAC error information
  3246. PUSH LPBYTE     Indicate  ; Virtual address of indicate flag
  3247. PUSH WORD       5         ; End Reset Indication
  3248. PUSH WORD       ProtDS    ; DS of called protocol module
  3249. Call Status
  3250.  
  3251. Returns:    0x0000    SUCCESS
  3252.             0x0008    INVALID_FUNCTION
  3253.  
  3254. Description:
  3255.  
  3256. Called to indicate that the adapter has finished a reset and
  3257. follows the StartReset indication.  The protocol may return
  3258. INVALID_FUNCTION if it was written to the 1.0.1 version of this
  3259. specification, where it assumes end of reset on IndicationComplete.
  3260. To ensure compatibility with 1.0.1 protocol drivers, the MAC must
  3261. ensure the IndicationComplete is called after EndReset and before
  3262. any other indications.
  3263.  
  3264. EndReset will pass up a success/fail code for ResetMAC in
  3265. the Status parameter.
  3266.  
  3267.             0x0000    SUCCESS
  3268.             0x0024    HARDWARE_ERROR
  3269.             0x002A    NETWORK_MAY_NOT_BE_CONNECTED
  3270.             0x00FF    GENERAL_FAILURE
  3271.  
  3272. As with any other indication, EndReset is entered with
  3273. indications implicitly disabled.  To protect itself from other
  3274. indications the protocol may choose to modify the Indicate flag
  3275. to keep indications disabled on return.  MAC drivers must be
  3276. prepared for the possibility that both StartReset and EndReset
  3277. allow the protocol to modify this flag.
  3278.  
  3279. EndReset is not affected by IndicationOn and IndicationOff. In
  3280. other words, if the protocol modifies the indicate flag during 
  3281. StartReset to disable indications, this will not prevent the
  3282. EndReset indication from being generated.
  3283.  
  3284. If both StartReset and EndReset disable indications, the 
  3285. IndicationOff depth is 2, requiring two calls to IndicationOn
  3286. in order to enable indications. For example, if protocol A
  3287. disables indications during StartReset and protocol B disables
  3288. indications during EndReset, both protocols must issue IndicationOn 
  3289. before indications are re-enabled. The same is true if the same 
  3290. protocol issues IndicationOff twice.
  3291.  
  3292. Interrupt
  3293.  
  3294. Purpose:  Imply that an interrupt has occurred as the result of an
  3295. interrupt request.
  3296.  
  3297. PUSH WORD     MACID     ; Module ID of MAC
  3298. PUSH WORD     0         ; Pad parameter must be 0
  3299. PUSH LPBYTE   Indicate  ; Virtual address of indicate flag
  3300. PUSH WORD     4         ; Interrupt indication
  3301. PUSH WORD     ProtDS    ; DS of called protocol module
  3302. Call Indication
  3303.  
  3304. Returns:  0x0000    SUCCESS
  3305.  
  3306. Description:
  3307.  
  3308. The MAC calls this function to indicate to a protocol that an
  3309. interrupt requested by an Interrupt request has occurred.  Since
  3310. this indication may be deferred by disabling indications, a
  3311. protocol may use this mechanism to implement a simple scheduling
  3312. scheme to allow it to regain control once outside of a critical
  3313. code region.  The MAC may at its discretion suppress the
  3314. generation of this indication if there is another indication
  3315. pending which may be issued in place of the Interrupt status
  3316. indication.
  3317.  
  3318. System Requests
  3319.  
  3320. All MAC and protocol modules implement a set of system request
  3321. functions that support module-independent functions such as
  3322. binding.  The caller of these functions is usually the Protocol
  3323. Manager.  The entry point for system requests is defined in the
  3324. common characteristics table for the module.  All system requests
  3325. are implemented synchronously.  Note that all pointers in system
  3326. requests are Ring 0 GDT virtual addresses.
  3327.  
  3328. All system requests have the following common calling convention:
  3329.  
  3330. PUSH DWORD     Param1    ; Request dependent dword parameter or 0
  3331. PUSH DWORD     Param2    ; Request dependent dword parameter or 0
  3332. PUSH WORD      Param3    ; Request dependent word parameter or 0
  3333. PUSH WORD      Opcode    ; Opcode of request
  3334. PUSH WORD      TargetDS  ; DS of called module
  3335. Call System
  3336.  
  3337.  
  3338. InitiateBind
  3339.  
  3340. Purpose:  Instruct a module to bind to another module.
  3341.  
  3342. PUSH DWORD    0         ; Pad parameter must be 0
  3343. PUSH LPBUF    CharTab   ; Characteristics of module to bind
  3344. PUSH WORD     LastBind  ; Non-zero if last InitiateBind
  3345. PUSH WORD     1         ; Initiate Bind Request
  3346. PUSH WORD     ProtDS    ; DS of called Protocol module
  3347. CALL System
  3348.  
  3349. Returns:    0x0000    SUCCESS
  3350.             0x0008    INVALID_FUNCTION
  3351.             0x0021    INCOMPLETE_BINDING
  3352.             0x0022    DRIVER_NOT_INITIALIZED
  3353.             0x0023    HARDWARE_NOT_FOUND
  3354.             0x0024    HARDWARE_FAILURE
  3355.             0x0025    CONFIGURATION_FAILURE
  3356.             0x0026    INTERRUPT_CONFLICT
  3357.             0x0027    INCOMPATIBLE_MAC
  3358.             0x0028    INITIALIZATION_FAILED
  3359.             0x002A    NETWORK_MAY_NOT_BE_CONNECTED
  3360.             0x002B    INCOMPATIBLE_OS_VERSION
  3361.             0x00FF    GENERAL_FAILURE
  3362.  
  3363. Description:
  3364.  
  3365. This call is issued by the Protocol Manager to an upper protocol
  3366. module.  It passes the address of the characteristics table of
  3367. the lower module that the upper module must issue a Bind call to.
  3368. If the upper module specified a BindingsList including more than
  3369. one lower module, then InitiateBind's will be issued for those
  3370. modules in the order the lower modules are listed in the
  3371. BindingsList structure.  LastBind is used to indicate the last
  3372. Initiate Bind request so the module may perform any final
  3373. initialization prior to returning.  In the static default binding
  3374. case of one static protocol and one MAC, the Protocol Manager
  3375. will issue an InitiateBind passing the characteristics table of
  3376. the MAC even if no bindings list was specified.  In this case
  3377. LastBind will be non-zero.  In the non-default case if a module
  3378. other than a MAC does not have lower bindings (having a Bindlist
  3379. with a NumBindings count = 0), the Protocol Manager will still
  3380. issue an Initiate Bind to the module to allow final
  3381. initialization.  In this case CharTab will be NULL and LastBind
  3382. will be non-zero.
  3383.  
  3384. If the Bind operation fails then the Initiate Bind operation must
  3385. also fail returning the same return code as the failing Bind
  3386. call.
  3387.  
  3388. If a module returns a non-SUCCESS code on InitiateBind,  in the
  3389. dynamic mode the Protocol Manager will automatically deregister
  3390. that module and remove all reference to it in its bind tables.
  3391. In particular any other module that had registered (via
  3392. RegisterModule) its intention to bind with the failed module will
  3393. get an InitiateBind call with the "CharTab" pointer far NULL and
  3394. "LastBind" non-zero.  A module that has lower bindings and
  3395. receives an InitiateBind with a NULL bind "CharTab" must generate
  3396. a non-SUCCESS return code in order to force the Protocol Manager
  3397. to deregister it.  In DOS it is recommended that a dynamic module
  3398. that failed its bind deinstall itself.  In OS/2 it is recommended
  3399. that the dynamic driver that failed its bind leave its dynamic
  3400. segments unlocked.
  3401.  
  3402.  
  3403. Bind
  3404.  
  3405. Purpose:  Exchange module characteristic table information.
  3406.  
  3407. PUSH LPBUF    CharTab   ; Pointer to caller's table
  3408. PUSH LPBUF    TabAddr   ; Address where to return a pointer
  3409.                         ; to called module's characteristics
  3410. PUSH WORD     0         ; Pad parameter must be zero
  3411. PUSH WORD     2         ; Bind Request
  3412. PUSH WORD     TargetDS  ; DS of called module
  3413. CALL System
  3414.  
  3415. Returns:    0x0000    SUCCESS
  3416.             0x0008    INVALID_FUNCTION
  3417.             0x0022    DRIVER_NOT_INITIALIZED
  3418.             0x0023    HARDWARE_NOT_FOUND
  3419.             0x0024    HARDWARE_FAILURE
  3420.             0x0025    CONFIGURATION_FAILURE
  3421.             0x0026    INTERRUPT_CONFLICT
  3422.             0x0027    INCOMPATIBLE_MAC
  3423.             0x0028    INITIALIZATION_FAILED
  3424.             0x002A    NETWORK_MAY_NOT_BE_CONNECTED
  3425.             0x002B    INCOMPATIBLE_OS_VERSION
  3426.             0x00FF    GENERAL_FAILURE
  3427.  
  3428. Description:
  3429.  
  3430. Used by one module to bind to another.  It exchanges pointers to
  3431. characteristics tables between the two modules.  A MAC will
  3432. accept only one bind and will not accept additional bind attempts.
  3433.  
  3434. For compatibility with Remote Initial Program Load, MAC drivers
  3435. must not manipulate the network adapter at INIT time.  The MAC
  3436. driver is free to determine if the network adapter is present,
  3437. but must leave any hardware manipulation to Bind time processing.
  3438.  
  3439.  
  3440. InitiatePrebind (OS/2 only)
  3441.  
  3442. Purpose:  In OS/2 dynamic bind mode instruct a module to restart
  3443. its prebind initialization.
  3444.  
  3445. PUSH DWORD    0         ; Pad parameter (must be zero)
  3446. PUSH LPBUF    0         ; Pad parameter (must be zero)
  3447. PUSH WORD     0         ; Pad parameter (must be zero
  3448. PUSH WORD     3         ; Initiate Prebind Request
  3449. PUSH WORD     ProtDS    ; DS of called protocol module
  3450. CALL System
  3451.  
  3452. Returns:    0x0000    SUCCESS
  3453.             0x00FF    GENERAL_FAILURE
  3454.  
  3455. Description:
  3456.  
  3457. In the OS/2 dynamic mode, this call is issued by the Protocol
  3458. Manager to a dynamically loadable protocol driver when the
  3459. Protocol Manager InitAndRegister is called.  This function is
  3460. available for the protocol driver to restart its prebind
  3461. initialization when it is dynamically reloaded.
  3462.  
  3463. An OS/2 dynamic protocol driver is assumed to be made up of
  3464. static and transient segments.  When the protocol is not needed,
  3465. the transient segments are unlocked (using the DevHlp Unlock
  3466. command) to allow them to be swapped out.  When the protocol is
  3467. needed again, InitiatePrebind is issued.  During InitiatePrebind,
  3468. the driver needs to Lock down its dynamic segments (using the
  3469. DevHlp Lock command, type 1) to force them back into memory and
  3470. make them addressable again.  The protocol must save the lock
  3471. handle returned by this call for later Unlock'ing.  Also, the
  3472. prebind initialization sequence is initiated in this call and
  3473. consists of re-reading the PROTOCOL.INI memory image,
  3474. configuration initialization, prebind memory allocations, and
  3475. registration with the Protocol Manager.  The protocol module
  3476. typically carries out here the same functions that are performed
  3477. by a static protocol module when a strategy routine INIT command
  3478. is given.
  3479.  
  3480.  
  3481. InitiateUnbind
  3482.  
  3483. Purpose:  Instruct a module to unbind from another module.
  3484.  
  3485. PUSH DWORD    0           ; Pad parameter (must be zero)
  3486. PUSH LPBUF    CharTab     ; Char's of module to unbind
  3487. PUSH WORD     LastUnbind  ; Non-zero if last Init'Unbind
  3488. PUSH WORD     4           ; Initiate Unbind Request
  3489. PUSH WORD     ProtDS      ; DS of called protocol module
  3490. CALL System
  3491.  
  3492. Returns:  0x0000    SUCCESS
  3493.           0x00FF    GENERAL_FAILURE
  3494.  
  3495. Description:
  3496.  
  3497. This call is issued by the Protocol Manager in dynamic mode to an
  3498. upper protocol module.  It passes the address of the characteristics
  3499. table of the lower module that the upper module must issue an 
  3500. Unbind command to (this would be an entry into the VECTOR if the
  3501. lower module is a MAC).  LastUnbind is used to indicate the last
  3502. InitiateUnbind request, so the module may perform any final cleanup
  3503. before returning.
  3504.          
  3505. If a protocol module does not have lower bindings (having a
  3506. BindingsList with a NumBindings count = 0), InitiateUnbind will
  3507. still be issued with CharTab set to NULL and LastUnbind set to
  3508. non-zero in order to allow the module to terminate.
  3509.  
  3510.  
  3511. Unbind
  3512.  
  3513. Purpose:  An unbind request from an upper protocol module to a
  3514. lower module.
  3515.  
  3516. PUSH LPBUF     CharTab      ; Caller's characteristics table
  3517. PUSH DWORD     0            ; Pad parameter (must be zero)
  3518. PUSH WORD      0            ; Pad parameter (must be zero)
  3519. PUSH WORD      5            ; Unbind Request
  3520. PUSH WORD      TargetDS     ; DS of called module
  3521. CALL System
  3522.  
  3523. Returns:  0x0000    SUCCESS
  3524.           0x0008    INVALID_FUNCTION
  3525.           0x00FF    GENERAL_FAILURE
  3526.  
  3527. Description:
  3528.  
  3529. Used by one protocol module to unbind from another.  The caller's
  3530. characteristics table is passed to permit the called module to
  3531. identify the upper module.  If the Unbind is to a MAC, the VECTOR
  3532. does the Unbind cleanup on behalf of the MAC.  Thus MAC drivers
  3533. themselves do not need to support this call.
  3534.  
  3535. Protocol Manager Primitives
  3536.  
  3537. Since the Protocol Manager primitives may be accessed via an
  3538. IOCTL in OS/2, a request block is defined as follows:
  3539.  
  3540. struct ReqBlock
  3541. {
  3542.    unsigned Opcode;      /*Opcode for Protocol Manager request  */
  3543.    unsigned Status;      /*Status at completion of request      */
  3544.    char far *Pointer1;   /*First parameter Ring 0 GDT pointer   */
  3545.    char far *Pointer2;   /*Second parameter Ring 0 GDT pointer  */
  3546.    unsigned Word1;       /*Parameter word                       */
  3547. };
  3548.  
  3549. Direct calls are made to the Protocol Manager with a pointer to
  3550. the ReqBlock on the stack.  For IOCTL requests, the parameter
  3551. buffer contains a pointer to the ReqBlock.  The direct calling
  3552. sequence is as follows:
  3553.  
  3554. PUSH LPBUF       ReqBlock  ; Ring 0 GDT Address of ReqBlock
  3555. PUSH WORD        TargetDS  ; DS of Protocol Manager
  3556. Call ProtManEntry
  3557.  
  3558. Note that under OS/2 the direct entry cannot be used at
  3559. CONFIG.SYS initialization time since the driver is still in Ring
  3560. 3 context.
  3561.  
  3562. Note also that if the Protocol Manager is in dynamic mode, these
  3563. primitives can be invoked by other modules after system
  3564. initialization.  Dynamic OS/2 Ring 0 device drivers issuing these
  3565. primitives post INIT time must use the direct entry interface
  3566. since the IOCTL interface is illegal at this time.
  3567.  
  3568.  
  3569. GetProtocolManagerInfo
  3570.  
  3571. Purpose:  Retrieve pointer to configuration image.
  3572.  
  3573. Opcode    - 1
  3574.  
  3575. Status    - On return contains request status
  3576.  
  3577. Pointer1  - On return contains a FAR pointer to structure memory
  3578.           image representing the parsed user configuration file
  3579.           PROTOCOL.INI.  For static OS/2 device drivers, the
  3580.           selector of the pointer returned here is valid only at
  3581.           device INIT time.  For dynamic OS/2 device drivers, the
  3582.           selector returned is always valid and will be a valid
  3583.           LDT selector for the process under which this primitive
  3584.           is called.  For DOS this is a segment:offset pair.
  3585.  
  3586. Pointer2  - Unused
  3587.  
  3588. Word1     - On return contains the BCD-encoded major (low byte in
  3589.           memory) and minor (high byte in memory) version of the
  3590.           specification on which this Protocol Manager driver is
  3591.           based.  (2.0 for this specification)
  3592.  
  3593. Returns:    0x0000    SUCCESS   
  3594.             0X0008    INVALID_FUNCTION
  3595.             0x0002F   INFO_NOT_FOUND
  3596.             0x00FF    GENERAL_FAILURE
  3597.  
  3598. Description:
  3599.  
  3600. This request is used by a module to obtain the configuration
  3601. information parsed from the user-defined protocol configuration
  3602. file PROTOCOL.INI.  Modules invoke this function during device
  3603. driver initialization to obtain this information for initializing
  3604. configuration variables and making dynamic memory allocations and
  3605. to determine their inter-module bindings.
  3606.  
  3607. In DOS dynamic mode, INFO_NOT_FOUND is returned if the Protocol
  3608. Manager detects that the structured memory image is not valid.
  3609. This can occur if prior to loading a dynamic module the
  3610. structured configuration memory image was not registered with the
  3611. Protocol Manager via a RegisterProtocolManagerInfo command or if
  3612. the memory image got corrupted between registering it and getting
  3613. it via the current primitive.  The corruption might occur if
  3614. another DOS program is loaded between the memory image
  3615. registrations and the memory image read operation by a dynamic
  3616. protocol invoking the GetProtocolManagerInfo primitive.
  3617.  
  3618. This request is valid in both the static and dynamic modes of
  3619. Protocol Manager operation.  In the static mode, this request is
  3620. only valid prior to binding and starting.  Invoking this
  3621. primitive in static mode after all modules are bound and started
  3622. will cause INVALID_FUNCTION to be returned by Protocol Manager.
  3623.  
  3624. RegisterModule
  3625.  
  3626. Purpose:  Register a module and its bindings.
  3627.  
  3628. Opcode    - 2
  3629.  
  3630. Status    - On return contains request status
  3631.  
  3632. Pointer1  - Contains a FAR pointer to the module's common
  3633.           characteristics table.  The module must have all
  3634.           information in that table filled in except for the
  3635.           Module ID which is filled in by the Protocol Manager on
  3636.           return.
  3637.  
  3638. Pointer2  -Contains a FAR pointer to a BindingsList structure of
  3639.           the modules to which this module wishes to be bound to.
  3640.           The Protocol Manager will use only the information
  3641.           passed in the BindingsList to determine the relevant
  3642.           module bindings.  This pointer can be FAR NULL to
  3643.           indicate that this module will not currently bind to
  3644.           any module.  This latter option is useful for dynamic
  3645.           OS/2 modules that need to register their module name
  3646.           with the Protocol Manager but do not wish to remain
  3647.           fully resident (and therefore bind) at the current
  3648.           time.  This non-bindable registration permits the
  3649.           dynamic driver to reregister with a BindingsList when
  3650.           it is later reloaded and made operational.
  3651.  
  3652. Word1      -Unused
  3653.  
  3654. Returns:  0x0000    SUCCESS
  3655.           0x0008    INVALID_FUNCTION
  3656.           0x002C    ALREADY_REGISTERED
  3657.           0x00FF    GENERAL_FAILURE
  3658.  
  3659. Description:
  3660.  
  3661. This request is used by a driver or dynamically loadable
  3662. executable to identify one of its contained modules to the
  3663. Protocol Manager.  After calling RegisterModule, a static driver
  3664. must  remain installed and respond to system requests.  A dynamic
  3665. OS/2 driver must leave its system entry function code permanently
  3666. locked in memory.  A dynamic DOS module must remain installed and
  3667. respond to system requests until it is unbound and unloaded.
  3668. This registration is accomplished by passing a pointer to the
  3669. module's characteristics table to the Protocol Manager.  The
  3670. driver also passes a bindings list requested by the module.  The
  3671. bindings list contains the one or more module names which the
  3672. module wishes to bind to as a client.  This bindings information
  3673. is later used by the Protocol Manager to determine the necessary
  3674. sequence of InitiateBind commands to issue.  This bindings list
  3675. must persist while the protocol is operational.  In the static
  3676. default bindings case of one static protocol and one MAC, the
  3677. bindings list pointer provided in this request can be NULL
  3678. indicating that a protocol module by default will bind to the
  3679. single underlying MAC.  Otherwise in the non-default bindings
  3680. case, a NULL bindings list pointer provided in this request will
  3681. indicate that this module will not bind to any other module at
  3682. the current time and is not ready to initialize.  In this latter
  3683. case the Protocol Manager will not call the module's InitiateBind
  3684. system function.  A NULL binding list pointer is particuarly
  3685. useful for dynamic OS/2 drivers that register their module name
  3686. at  INIT time, but are not to remain fully resident at startup
  3687. time.  This is called a non-bindable registration.  A protocol
  3688. module can also pass a non-NULL bindings list with a 0 number of
  3689. bindings count.  In the default bindings case, this is
  3690. interpreted by the Protocol Manager to bind the protocol to the
  3691. single underlying MAC.  In the non-default bindings configuration
  3692. this means that a protocol is registering without any lower
  3693. bindings, but is required to be initialized by an InitiateBind
  3694. call.
  3695.  
  3696. A driver which contains multiple modules can call RegisterModule
  3697. multiple times, once for each module.  The Protocol Manager
  3698. responds to each request by assigning each module a module ID.
  3699. The module ID is returned in the module's characteristics table
  3700. on completion of the RegisterModule request.
  3701.  
  3702. If a module name is currently registered with the Protocol
  3703. Manager, an attempt to register the same module name will fail
  3704. and a status code of ALREADY_REGISTERED  will be returned.  A
  3705. dynamic OS/2 driver is considered currently registered if it had
  3706. previously registered with a non-NULL bindings list indicating a
  3707. requirement to bind and/or start and it had not yet unbound.
  3708. Thus a dynamic OS/2 driver can reregister with the Protocol
  3709. Manager under the same module names if it either had unbound or
  3710. had not previously made a bindable registration.
  3711.  
  3712. This request is valid in both the static and dynamic modes of
  3713. Protocol Manager operation.  In the static mode, this request in
  3714. only valid prior to binding and starting.  Invoking this
  3715. primitive in static mode after all modules are bound and started
  3716. will cause INVALID FUNCTION to be returned by the Protocol
  3717. Manager.  A registration of a dynamic module (bit 2 set of the
  3718. "module function flags" in the Common Characteristics table) in
  3719. static Protocol Manager mode is invalid and will generate
  3720. INVALID_FUNCTION.  It is mandatory that all static DOS and static
  3721. and dynamic OS/2 device drivers invoke this function at least
  3722. once at INIT time.
  3723.  
  3724. BindAndStart
  3725.  
  3726. Purpose:  Initiate the binding process.
  3727.  
  3728. Opcode    - 3
  3729.  
  3730. Status    - On return contains request status
  3731.  
  3732. Pointer1  - Caller's virtual address of FailingModules structure.
  3733.      This structure in the caller's address space is filled  in by the Protocol
  3734.      Manager prior to returning from BindAndStart.  If BindAndStart reports
  3735.      an error, it contains the module names in ASCIIZ format of the upper module
  3736.      and lower module (may be a NULL string) reporting the error.
  3737.      If BindAndStart is successful then both are NULL strings.
  3738.  
  3739.      struct FailingModules {
  3740.    char UpperModuleName[16];  /* Upper failing module*/
  3741.    char LowerModuleName{16}; /* Lower failing module*/
  3742.      };
  3743.  
  3744. Pointer2  - Unused
  3745.  
  3746. Word1     - Unused
  3747.  
  3748. Returns:  0x0000    SUCCESS
  3749.           0x0007    INVALID_PARAMETER
  3750.           0x0008    INVALID_FUNCTION
  3751.           0x0020    ALREADY_STARTED
  3752.           0x0021    INCOMPLETE_BINDING
  3753.           0x0022    DRIVER_NOT_INITIALIZED
  3754.           0x0023    HARDWARE_NOT_FOUND
  3755.           0x0024    HARDWARE_FAILURE
  3756.           0x0025    CONFIGURATION_FAILURE
  3757.           0x0026    INTERRUPT_CONFLICT
  3758.           0x0027    INCOMPATIBLE_MAC
  3759.           0x0028    INITIALIZATION_FAILED
  3760.           0x0029    NO_BINDING
  3761.           0x0002D   PATH_NOT_FOUND
  3762.           0x0002E   INSUFFICIENT_MEMORY
  3763.           0x00FF    GENERAL_FAILURE
  3764.  
  3765. Description:
  3766.  
  3767. This is used to trigger the Protocol Manager bind and start
  3768. sequence.  This permits an application program (e.g., executing
  3769. from a DOS batch or OS/2 command file) to trigger the bind
  3770. sequence.  The bind sequence is invoked by the Protocol Manager's
  3771. calling each module's inter-module InitiateBind function.  If an
  3772. InitiateBind fails then BindAndStart will fail with same return
  3773. code as the failing InitiateBind.
  3774.  
  3775. In the static mode of Protocol Manager operation, this request
  3776. can be invoked only once to bind and start all static drivers.
  3777. Successive invocations return INVALID_FUNCTION.
  3778.  
  3779. In the dynamic mode, this command tells the Protocol Manager to
  3780. issue the IntitiateBind primitive to all dynamically loaded
  3781. protocol drivers that have registered since the last InitiateBind
  3782. (or since the beginning of time for the first call).
  3783.  
  3784. In DOS, the caller is required to invoke this primitive via the
  3785. direct entry point rather than the DOS IOCTL method.  The
  3786. Protocol Manager will generate an INVALID_FUNCTION error if this
  3787. function is invoked by an IOCTL.  This will permit the protocol
  3788. modules to make DOS function calls during their bind and start
  3789. sequence initiated by this primitive (when the Protocol Manager
  3790. calls the InitiateBind system entry point of the protocol).  If
  3791. the IOCTL were used, the bind/start sequence would be carried out
  3792. inside of a DOS call and protocols would not be able to make
  3793. further DOS calls within their initialization sequence in order
  3794. to prevent DOS reentrancy.
  3795.  
  3796. In DOS the Protocol Manager loads PROTMAN.EXE to execute this
  3797. commnad.  The caller must have previously guaranteed that at
  3798. least 20k of memory is available to load PROTMAN.EXE prior to
  3799. invoking the BindAndStart primitive.  In static VECTOR
  3800. configurations (Chapter 7) PROTMAN.EXE will remain resident after
  3801. BindAndStart completes.  In such cases it is strongly recommended
  3802. that the caller free as much memory as possible prior to calling
  3803. BindAndStart so the PROTMAN.EXE will reside in the lowest memory
  3804. possible.  This will prevent large unusable gaps in DOS memory
  3805. when the calling function terminates.
  3806.  
  3807. A utility, NETBIND.EXE, that invokes the BindAndStart primitive
  3808. is provided with the Protocol Manager and is described in
  3809. Appendix E.
  3810.  
  3811. GetProtocolManagerLinkage
  3812. Purpose:  Retrieve Protocol Manager Dispatch and DS Value.
  3813.  
  3814. Opcode    - 4
  3815.  
  3816. Status    - On return contains request status
  3817.  
  3818. Pointer1  - On return contains the Protocol Manager Dispatch point.
  3819.  
  3820. Pointer2  - Unused
  3821.  
  3822. Word1     - On return contains the Protocol Manager DS.
  3823.  
  3824. Returns:  -     0x0000    SUCCESS
  3825.        0x0008    INVALID_FUNCTION
  3826.        0x00FF    GENERAL_FAILURE
  3827.  
  3828. Description:
  3829.  
  3830. This request is used by a module to obtain the dispatch entry
  3831. point and DS of the Protocol Manager.  Direct calls may then be
  3832. made by DOS & OS/2 Ring 0 drivers and DOS utilities to the
  3833. dispatch entry point.
  3834.  
  3835. All dynamically reloaded OS/2 protocol drivers must issue this
  3836. command to the Protocol Manager at CONFIG.SYS INIT time using the
  3837. IOCTL mechanism and must save the Ring 0 Protocol Manager
  3838. dispatch entry point and DS.  When the driver subsequently re-
  3839. registers with the Protocol Manager on reload at post INIT time,
  3840. it must do so via the direct entry interface using the saved
  3841. entry point and DS (since an IOCTL would be illegal at that
  3842. time).
  3843.  
  3844. Any DOS utility that intends to invoke the BindAndStart or
  3845. UnbindAndStop Protocol Manager primitives must first invoke this
  3846. primitive to get the Protocol Manager's direct entry point.
  3847.  
  3848. This request is valid in both the static and dynamic modes of
  3849. Protocol Manager operation.  In the static mode, this request is
  3850. only valid prior to binding and starting.  Invoking this
  3851. primitive in static mode after all modules are bound and started
  3852. will cause INVALID_FUNCTION to be returned by the Protocol
  3853. Manager.
  3854.  
  3855. GetProtocolIniPath
  3856. Purpose:  A command to obtain the path to the PROTOCOL.INI file
  3857.           read by the Protocol Manager when it initialized.
  3858.  
  3859. Opcode    - 5
  3860.  
  3861. Status    - On return contains request status
  3862.  
  3863. Pointer1  - The virtual FAR pointer to a buffer, which will
  3864.             contain the returned PROTOCOL.INI pathname in ASCIIZ
  3865.             format on completion.
  3866.  
  3867. Pointer2  - Unused
  3868.  
  3869. Word1   - The length of the provided buffer on input.
  3870.  
  3871. Returns:  -    0x0000    SUCCESS
  3872.                0x0007    INVALID_PARAMETER
  3873.                0x0008    INVALID_FUNCTION
  3874.  
  3875. Description:
  3876.  
  3877. This primitive can be called by an application program or
  3878. dynamically loadable protocol that will read and parse the
  3879. PROTOCOL.INI file to obtain the original location of the
  3880. PROTOCOL.INI file used by the Protocol Manager when it
  3881. initialized.  This permits such a program to use the same file
  3882. read by the Protocol Manager.  The Protocol Manager returns only
  3883. the pathname to the subdirectory containing the PROTOCOL.INI
  3884. file, excluding the string "PROTOCOL.INI", which may be up to 60
  3885. characters in length.  This string will include the drive
  3886. identifier and be fully qualified relative to the root.  The
  3887. buffer must be large enough to hold the returned string.  If not,
  3888. the contents of the buffer are undefined and the
  3889. INVALID_PARAMETER error returned.
  3890.  
  3891. This request is valid in both the static and dynamic modes of
  3892. Protocol Manager operation.  In the static mode, this request is
  3893. only valid prior to binding and starting.  Invoking this
  3894. primitive in static mode after all modules are bound and started
  3895. will cause INVALID_FUNCTION to be returned by the Protocol
  3896. Manager.
  3897.  
  3898. RegisterProtocolManagerInfo
  3899. Purpose:  A command valid only in the dynamic mode to register
  3900.           the current startingaddress of the PROTOCOL.INI memory
  3901.           image with the Protocol Manager.
  3902.  
  3903. Opcode    - 6
  3904.  
  3905. Status    - On return contains request status
  3906.  
  3907. Pointer1  - The virtual FAR pointer to the structured memory
  3908.             image representing the parsed user configuration file,
  3909.             PROTOCOL.INI.
  3910.  
  3911. Pointer2  - Unused
  3912.  
  3913. Word1     - Length of structured memory image
  3914.  
  3915. Returns:  -    0x0000    SUCCESS
  3916.                0x0008    INVALID_FUNCTION
  3917.  
  3918. Description:
  3919.  
  3920. In dynamic mode, this command registers with the Protocol Manager
  3921. the address of the PROTOCOL.INI memory image.  It is assumed that
  3922. prior to dynamically loading a protocol module, the PROTOCOL.INI
  3923. file is re-read and re-parsed in some memory image.  The pointer
  3924. to the memory image is given to the Protocol Manager, so that it
  3925. is available for the "GetProtocolManagerInfo" primitive of the
  3926. dynamic initializing module that reads its configuration
  3927. parameters.
  3928.  
  3929. In static mode, this command is illegal and the INVALID_FUNCTION
  3930. error code is returned.
  3931.  
  3932. A utility, READPRO.EXE, that reads and parses the PROTOCOL.INI
  3933. file into a memory image and registers this with the Protocol
  3934. Manager is provided with the Protocol Manager and is described in
  3935. Appendix E.
  3936.  
  3937. InitAndRegister
  3938. Purpose:  An optional dynamic OS/2 command to dynamically restart
  3939.           the prebind initialization of a dynamically reloadable
  3940.           protocol driver.
  3941.  
  3942. Opcode    - 7
  3943.  
  3944. Status    - On return contains request status
  3945.  
  3946. Pointer1  - Unused
  3947.  
  3948. Pointer2  - FAR virtual pointer to an ASCIIZ buffer containing
  3949.             the name of the  module to be prebind initialized.
  3950.  
  3951. Word1     - Unused
  3952.  
  3953. Returns:  -      0x0000    SUCCESS
  3954.                  0x0007    INVALID_PARAMETER
  3955.                  0x0008    INVALID_FUNCTION
  3956.                  0x00FF    GENERAL_FAILURE
  3957.  
  3958. Description:
  3959.  
  3960. In OS/2 dynamic mode, this reactivates the transient portions of
  3961. a protocol driver previously statically loaded at system startup,
  3962. but for which the transient portions of the driver were not
  3963. locked down.  The command causes the Protocol Manager to invoke
  3964. the system entry point of the specified module with the
  3965. function"InitiatePrebind" in order for the driver to restart its
  3966. prebind initialization.  The prebind initialization functions are
  3967. driver specific.  However, it is expected that such functions
  3968. might include
  3969.  
  3970. o    locking down its dynamic segments using the DevHlp Lock
  3971.      command (lock type1) and saving the returned lock handle.
  3972.  
  3973. o    getting its PROTOCOL.INI configuration information
  3974.  
  3975. o    doing its prebind initialization,
  3976.  
  3977. o    and finally, re-registering with the Protocol Manager.
  3978.  
  3979. In static mode, this command is illegal and the INVALID_FUNCITON
  3980. error code is returned.
  3981.  
  3982. UnbindAndStop
  3983. Purpose:  A dynamic binding command to terminate a transient
  3984.           previously dynamically bound protocol module and to
  3985.           terminate its bindings.
  3986.  
  3987. Opcode    - 8
  3988.  
  3989. Status    - On return contains request status
  3990.  
  3991. Pointer1  - Failing modules as for the "BindAndStart" command
  3992.  
  3993. Pointer2  - If non-NULL, FAR virtual pointer to an ASCIIZ buffer
  3994.             containing the name of the module to be unbound.
  3995.  
  3996.             If NULL, then terminates a set of previously dynamically
  3997.             bound protocol modules as defined below.  Valid only for DOS.
  3998.  
  3999. Word1     - Unused
  4000.  
  4001. Returns:  -      0x0000    SUCCESS
  4002.                  0x0007    INVALID_PARAMETER
  4003.                  0x0008    INVALID_FUNCTION
  4004.                  0x0002D   PATH_NOT_FOUND
  4005.                  0x0002E   INSUFFICIENT_MEMORY
  4006.  
  4007. Description:
  4008.  
  4009. This is used in the dynamic mode to terminate either a specific
  4010. protocol module or a set of previously dynamically bound protocol
  4011. modules and to terminate their binds.  A "set" is the collection
  4012. of protocol modules previously loaded or reloaded between two
  4013. successive "BindAndStart" calls or between the last
  4014. "BindAndStart" and this call.  Successive "UnbindAndStop"
  4015. commands with NULL Pointer2 arguments terminate protocol sets in
  4016. the reverse order in which they were bound.  The Protocol Manager
  4017. removes reference to the protocols from its VECTOR (for MAC
  4018. unbindings) table and general binding tables.  The Protocol
  4019. Manager issues an "InitiateUnbind" command to each protocol to be
  4020. unbound so that the protocol can issue an "Unbind" command to the
  4021. modules it is bound to.  For MAC unbindings, the "Unbind" is
  4022. issued back to the Protocol Manager VECTOR.  The NULL Pointer2
  4023. option is used in DOS environments for TSR protocol modules in
  4024. which the unbind sequence usually proceeds in reverse order of
  4025. the bind sequence.  The non-NULL Pointer2 option must be used in
  4026. OS/2 environments.  The NULL Pointer2 option is invalid for OS/2.
  4027.  
  4028. In DOS, the caller is required to invoke this primitive via the
  4029. direct entry point method rather than the DOS IOCTL method.  The
  4030. Protocol Manager will generate an INVALID_FUNCTION error if this
  4031. function is invoked by an IOCTL.  This will permit the protocol
  4032. modules to be terminated to make DOS function calls during their
  4033. unbind/stop sequence initiated by this primitive (when the
  4034. Protocol Manager calls the InitiateUnbind system entry point of
  4035. the protocol).  If the IOCTL were used, the unbind/stop sequence
  4036. would be carrried out inside of a DOS call, and protocols would
  4037. not be able to make further DOS calls within their termination
  4038. sequence in order to prevent DOS reentrancy.
  4039.  
  4040. In DOS the Protocol Manager loads PROTMAN.EXE to execute this
  4041. command.  The caller must have previously guaranteed that at
  4042. least 20K of memory is available to load PROTMAN.EXE prior to
  4043. invoking the UnbindAndStop primitive.
  4044.  
  4045. A utility, UNBIND.EXE, that invokes the UnbindAndStop primitive
  4046. is provided with the Protocol Manager and is described in
  4047. Appendix E.
  4048.  
  4049. In static mode, this command is illegal and the INVALID_FUNCTION
  4050. error code is returned.
  4051.  
  4052. BindStatus
  4053. Purpose:  A command to obtain information from the Protocol
  4054.           Manager about the   current set of bound modules.
  4055.  
  4056. Opcode    - 9
  4057.  
  4058. Status    - On return contains request status
  4059.  
  4060. Pointer1  - On input, under OS/2 only, if the caller is in Ring 3, 
  4061.             this must be a FAR  virtual pointer to a buffer
  4062.             where the returned information will be stored.
  4063.           - On input, under DOS or in OS/2, if the caller is in
  4064.             Ring 0, this pointer must be NULL.
  4065.           - On output, Pointer1 points to the root tree.
  4066.  
  4067. Pointer2  - NULL
  4068.  
  4069. Word1     - only used in OS/2
  4070.           - Length of buffer (input) and bytes copied (output).
  4071.  
  4072. Returns:  -      0x0000    SUCCESS
  4073.                  0x0008    INVALID_FUNCTION
  4074.                  0x000D    BUFFER_TOO_SMALL
  4075. Description:
  4076.  
  4077. If enabled by the Protocol Manager's BINDSTATUS=YES parameter in
  4078. PROTOCOL.INI, this command can be called at any time to obtain
  4079. information from the Protocol Manager about the current set of
  4080. bound modules.  If this command is disabled, an attempt to invoke
  4081. this command will return INVALID_FUNCTION.
  4082.  
  4083. The following characteristics tables are returned for the modules
  4084. which qualify:
  4085.  
  4086.      Common Characteristics
  4087.  
  4088.      Service-Specific Characteristics (including the Multicast
  4089.      Address List for MAC modules)
  4090.  
  4091.      Service-Specific Status
  4092.  
  4093.      Media-Specific Statistics (for MAC modules only)
  4094.  
  4095. The tables are linked together into a bind tree using a new
  4096. structure:
  4097.  
  4098.  struct BindNode {
  4099.       struct cctable far *commonptr;
  4100.       struct BindNode far *down;
  4101.       struct BindNode far *right;
  4102.  };
  4103.  
  4104. NOTE: There may be additional fields added to BindNodes in the
  4105. future, so do not rely on its exact size.
  4106.  
  4107. A BindNode is linked to its Common Characteristics Table (CCT) by
  4108. the CommonPtr field.  The CCT's are then linked into a bind tree
  4109. using the Right and Down pointers.  Down points to the first
  4110. BindNode bound below this one, and Right points to the next.  At
  4111. the top of the tree (the uppermost level), the Right pointers
  4112. also link together the BindNodes as if they are bound to a
  4113. virtual root BindNode.
  4114.  
  4115.  
  4116. A simple example might help illustrate this better:
  4117.  
  4118.    Protocol
  4119.   /    \
  4120.  MAC1   MAC2
  4121.  
  4122. which would be represented by the following bind tree:
  4123.  
  4124.  Protocol
  4125.     |
  4126.     V
  4127.  MAC1 -----> MAC2
  4128.  
  4129. where the BindNodes have been hidden to keep the diagram simple--
  4130. only their Down and Right pointers are shown.  The remaining Down
  4131. and Right pointers would be NULL.
  4132.  
  4133. One option when making this call is to pass a NULL buffer pointer
  4134. (in Pointer1), in which case the root BindNode pointer will be
  4135. returned in Pointer1.  The Protocol Manager uses BindNodes
  4136. internally to build the bind tree.  The caller can then run the
  4137. current bind tree to obtain information.  This is the only method
  4138. supported under DOS.  Under OS/2, this method will only work for
  4139. Ring 0 drivers.
  4140.  
  4141. Under OS/2, Ring 3 programs must use a second method by providing
  4142. a pointer to a buffer (in Pointer1) of a specified size (in
  4143. Word1) to copy the characteristics tables into.  In this case,
  4144. the Protocol Manager will copy the qualifying tables into the
  4145. buffer provided.  The first entry in the buffer will be the root
  4146. BindNode.  The order of the remaining BindNodes and tables within
  4147. the buffer is undefined.  The BindNodes and their various tables
  4148. are linked together by pointers which will be fixed up by the
  4149. Protocol Manager to use the same selector as the buffer itself
  4150. (i.e., Ring 3 if the buffer is Ring 3).  Specifically, the
  4151. Protocol Manager will fixup the following entries:
  4152.  
  4153. BindNode:
  4154.      CommonPtr
  4155.      Down
  4156.      Right
  4157. Common Characteristics:
  4158.      Pointer to service-specific characteristics
  4159.      Pointer to service-specific status
  4160. Service-Specific Characteristics
  4161.      Pointer to multicast address list (MAC's only)
  4162. Service-Specific Status
  4163.      Pointer to media-specific statistics (MAC's only)
  4164.  
  4165. The remaining pointers (e.g., dispatch tables and entry points)
  4166. will be in an undefined state and must not be relied upon.
  4167.  
  4168. If the buffer was too small, BUFFER_TOO_SMALL will be returned,
  4169. the pointers to tables which were not copied will be NULL, and
  4170. the bytes copied return parameter (Word1) will indicate where the
  4171. information was truncated.
  4172.  
  4173. The information returned is merely a snapshot at a particular
  4174. point of time.  The Protocol Manager will disable interrupts
  4175. while copying individual status and media-specific statistics
  4176. tables to guarantee their internal integrity.  The caller cannot
  4177. assume that all tables were copied in the same atomic operation
  4178. however.
  4179.  
  4180. In the case of OS/2, if two or more modules are bound to the same
  4181. lower module, the lower module's table is duplicated in the tree.
  4182. Therefore, the Ring 3 caller will have to provide larger amount
  4183. of buffer space for the returned information.
  4184.  
  4185. The number of nodes in the bind tree does not necessarily reflect
  4186. the number of modules bound.
  4187.  
  4188. RegisterStatus
  4189.  
  4190. Purpose:  A command to query whether a specific logical module is
  4191.           currently registered with the Protocol Manager.
  4192.  
  4193. Opcode:   - 0x0A
  4194.  
  4195. Status:   - On return contains request status
  4196.  
  4197. Pointer1  - NULL
  4198.  
  4199. Pointer2  - FAR virtual pointer to a 16-byte ASCIIZ module name
  4200.  
  4201. Word1- NULL
  4202.  
  4203. Returns:  -  0x0000  SUCCESS   
  4204.              0x0008  INVALID_FUNCTION
  4205.              0x002C  ALREADY_REGISTERED
  4206. Description:
  4207.  
  4208. This command can be called in either the static or dynamic mode
  4209. to determine whether a specific logical module is currently
  4210. registered with the Protocol Manager.  This can be used by the
  4211. caller to determine whether a specified module has already
  4212. registered with the Protocol Manager to prevent duplicate
  4213. registration.  A SUCCESS status returned means that the specified
  4214. module is not currently registered with the Protocol Manager.  An
  4215. ALREADY_REGISTERED status means that the module is currently
  4216. registered.
  4217.  
  4218. In the static mode, this request is only valid prior to binding
  4219. and starting.  Invoking this primitive in static mode after all
  4220. modules are bound and started will cause INVALID_FUNCTION to be
  4221. returned by the Protocol Manager.
  4222.  
  4223. Chapter 6:  Protocol Manager
  4224.  
  4225. Protocol Manager Initialization
  4226. The Protocol Manager is loaded and initialized in both the OS/2
  4227. and DOS environment via the operating system CONFIG.SYS INIT
  4228. sequence.  It must be loaded before any protocol or MAC driver is
  4229. loaded.  In DOS, the Protocol Manager will be provided in a file
  4230. called PROTMAN.DOS.  For OS/2, the file is PROTMAN.OS2.  The
  4231. device name for the Protocol Manager is PROTMAN$ under DOS and
  4232. \DEV\PROTMAN$ under OS/2 (the \DEV format is required by versions
  4233. 1.2 and later of OS/2).
  4234.  
  4235. In DOS to save memory, an additional dynamically loadable
  4236. component of the Protocol Manager called PROTMAN.EXE is provided.
  4237. This file must reside in the same directory as the static device
  4238. driver component, PROTMAN.DOS, itself.  This file is called for
  4239. execution by the Protocol Manager device driver component
  4240. whenever the Protocol Manager primitives BindAndStart and
  4241. UnbindAndStop are to be executed.  In the static VECTOR mode
  4242. (Chapter 7) PROTMAN.EXE will remain resident after BindAndStart
  4243. executes.
  4244.  
  4245. The Protocol Manager reads the PROTOCOL.INI file at  INIT time
  4246. and parses it to create the configuration memory image passed to
  4247. the protocol modules.  The file is located in the LANMAN
  4248. directory of the boot drive or the directory given by the /I:
  4249. parameter on the DEVICE=PROTMAN.xxx line in CONFIG.SYS.  Under
  4250. DOS, this image is relocated to just below the memory ceiling,
  4251. where it must remain untouched until all binding has completed.
  4252. The Protocol Manager computes a checksum of this image and checks
  4253. it at bind time to guarantee that the image has not been modified
  4254. in the interim.  Note that this memory is not  reserved by the
  4255. Protocol Manager.
  4256.  
  4257. If the Protocol Manager CONFIG.SYS initialization is successful
  4258. it is ready to support the initialization of the other drivers.
  4259. However the initialization can be aborted for either of the
  4260. following reasons:
  4261.  
  4262. 1. The Protocol Manager did not have enough memory to hold the
  4263.    PROTOCOL.INI configuration memory image.
  4264.  
  4265. 2. The Protocol Manager encountered a syntax error while parsing
  4266.    the PROTOCOL.INI file.  This could have been an illegal hex or
  4267.    decimal parameter value, an overflow condition (numeric value
  4268.    could not fit into 32 bits) was encountered or a string was
  4269.    encountered with missing end quotes.
  4270.  
  4271. These conditions are flagged as fatal errors to prevent erroneous
  4272. configuration parameters from propagating to the drivers for
  4273. their operation.
  4274.  
  4275. Static Binding Sequence
  4276. The Protocol Manager can be configured to operate either in the
  4277. static binding mode or in the dynamic binding mode.  In the
  4278. static binding mode, only statically loadable device drivers can
  4279. be loaded and bound once at system initialization time.  In the
  4280. dynamic binding mode, dynamically loadable protocol drivers can
  4281. be loaded and dynamically bound and unbound during system
  4282. operation on a demand basis.  Static drivers can also be loaded
  4283. at INIT time in dynamic mode.  The static binding sequence is
  4284. described in this section.  The dynamic binding sequence is
  4285. described in Chapter 7, "VECTOR and Dynamic Binding."
  4286.  
  4287. To determine the binding sequence, the Protocol Manager builds a
  4288. tree representing the bindings for all the modules in the system.
  4289. MAC drivers are at the bottom, and the highest level (for
  4290. example, NetBIOS) protocol layers at the top.  It then binds
  4291. module pairs together from the bottom up.  To do this, it issues
  4292. an InitiateBind to the upper module in the pair, passing it the
  4293. characteristics table of the lower module.  The upper module is
  4294. expected to issue a Bind to the lower module (if it is
  4295. acceptable) and return.  This continues with the next higher up
  4296. module.  If there is a module which is not bound to anything
  4297. else, it receives an InitiateBind with a NULL characteristics
  4298. table pointer.
  4299.  
  4300. To be more formal, the definitions listed below are required:
  4301.  
  4302. o A MAC driver is a protocol module with an upper layer interface
  4303.   level of  one (MAC layer) and a lower layer interface level of
  4304.   zero (physical).  It must support binding at its upper
  4305.   boundary.
  4306.  
  4307. o A MAC-layer entity is a protocol module with both upper and
  4308.   lower layer interface levels of one.  It must support binding
  4309.   at its lower boundary.
  4310.  
  4311. o A standalone protocol module is one which has a lower layer
  4312.   interface level of zero and which does not support binding at
  4313.   its upper boundary.
  4314.  
  4315. The Protocol Manager builds a tree with multiple branches.  Each
  4316. MAC driver is at the base of a branch, with the protocol layers
  4317. bound to it above it.  Standalone modules are also considered
  4318. branches by themselves.  The left-to-right order is defined by
  4319. the order in which the modules register with the Protocol
  4320. Manager.  The Protocol Manager does a pre-order transversal of
  4321. the tree, issuing InitiateBinds to all of the nodes except the
  4322. MAC drivers.
  4323.  
  4324. An important aspect of the binding scheme is that it allows for
  4325. modules to specify that they only do binding from above or below.
  4326. This is a requirement in cases where a monolithic module exposes
  4327. several interfaces, such as a NetBIOS, TLI, and DLC.  The TLI
  4328. could be presented as a logical module that had an upper
  4329. interface (the TLI) but no lower interface (since it uses a
  4330. private internal interface to its DLC).  Such a module would have
  4331. a characteristics table with the following settings:
  4332.  
  4333. DWORD  Module function flags, a bit mask (hints only):
  4334.        Bit 0 - set (binds at upper boundary)
  4335.        Bit 1 - clear (doesn't bind at lower boundary)
  4336. BYTE   Protocol level at upper boundary of module:
  4337.        4 - Transport
  4338. BYTE   Type of interface at upper boundary of module:
  4339.        1 => TLI
  4340. BYTE   Protocol level at lower boundary of module
  4341.        -1 - Not specified
  4342. BYTE   Type of interface at lower boundary of module:
  4343.        For any level: 0 => private (ISV defined)
  4344. LPBUF  Pointer to upper dispatch table
  4345. LPBUF  Pointer to lower dispatch table (NULL)
  4346.  
  4347. Sequence for non-VECTOR configurations:
  4348.  
  4349. 1. Protocol Manager driver (PROTMAN.OS2 for OS/2 or PROTMAN.DOS
  4350.    for DOS) is loaded during CONFIG.SYS initialization.  The
  4351.    Protocol Manager must be configured ahead of any MAC or
  4352.    protocol drivers in CONFIG.SYS.
  4353.  
  4354. 2. Protocol Manager initializes and reads PROTOCOL.INI to build
  4355.    the configuration memory image.
  4356.  
  4357. 3. MAC and protocol drivers are loaded by the operating system.
  4358.    During its initialization processing, each driver optionally
  4359.    does the following:
  4360.  
  4361.    a.  Open the PROTMAN$ device
  4362.  
  4363.    b.  Invoke the GetProtocolManagerInfo primitive to PROTMAN$ to
  4364.        get a pointer to the configuration memory image.
  4365.  
  4366.    c.  Read configuration parameters from the image and use these
  4367.        to finish initialization and build characteristics tables.
  4368.  
  4369.    d.  Use the RegisterModule function once for each module to be
  4370.        defined to the Protocol Manager.
  4371.  
  4372. 4. CONFIG.SYS processing ends and applications are started.
  4373.  
  4374. 5. An application opens the PROTMAN$ device and issues the
  4375.    BindAndStart IOCTL.  Such an application utility called
  4376.    NETBIND.EXE is provided with the Protocol Manager driver and
  4377.    is defined in Appendix E.
  4378.  
  4379. 6. The Protocol Manager uses information passed on previous
  4380.    RegisterModule calls to determine the module binding
  4381.    hierarchy.
  4382.  
  4383. 7. Proceeding from bottom to top of the binding hierarchy, the
  4384.    Protocol Manager uses InitiateBind to cause each module to
  4385.    bind to the module below it in the hierarchy.  Each module
  4386.    getting this call responds by issuing a Bind call to the
  4387.    module specified by the Protocol Manager on InitiateBind.
  4388.  
  4389. 8. When all modules have been bound, the Protocol Manager returns
  4390.    from BindAndStart.
  4391.  
  4392. The system is now fully operational.  Vector configurations are
  4393. similar, with the VECTOR being automatically inserted between
  4394. layers one and two, if necessary (on top of the MAC driver as
  4395. well as any MAC-layer entities which are present).
  4396.  
  4397.  
  4398.  
  4399. OS/2 Calling Convention
  4400. All of the Protocol Manager requests are supported by a single
  4401. OS/2 IOCTL function.  The services are demultiplexed via a
  4402. function code specified in the ReqBlock structure.
  4403.  
  4404. This IOCTL has the following IOCTL request packet parameters:
  4405.  
  4406. 1. Block Device Unit Code:  Undefined since the Protocol Manager
  4407.    is a character device.
  4408.  
  4409. 2. Command Code: 16 for Generic IOCTL.
  4410.  
  4411. 3. Status:  If the IOCTL corresponds to one of the Protocol
  4412.    Manager commands then the status field is returned with the
  4413.    ERR bit cleared signifying IOCTL successful completion.
  4414.    However the final status of the command is returned in the
  4415.    "status" field of the ReqBlock buffer as defined below.  Note
  4416.    that if the command is recognized the ERR bit is always
  4417.    cleared regardless of the status returned in "status".
  4418.    However if the command is not recognized an IOCTL status
  4419.    UNKNOWN_COMMAND (3) is returned with the ERR bit set.  Finally
  4420.    all of the commands return with the status "DON" bit set.
  4421.  
  4422. 4. Category code:  0x81 which is the LAN Manager category code.
  4423.  
  4424. 5. Function code:  0x58 for Protocol Manager command type.
  4425.  
  4426. 6. Parameter buffer:  Pointer to ReqBlock structure.
  4427.  
  4428. 7. Data buffer:  Unused and therefore the pointer is NULL.
  4429.  
  4430. By using the GetProtocolManagerLinkage request a module may
  4431. obtain the Protocol Manager dispatch point and DS.  Once a module
  4432. obtains the Protocol Manager's entry point and data segment it
  4433. passes the a request to the Protocol Manager via the following
  4434. function call:
  4435.  
  4436.    int (far pascal *ProtManEntry)(ReqBlockPtr, DataSeg);
  4437.    struct ReqBlock far *ReqBlockPtr;
  4438.    unsigned DataSeg;
  4439.  
  4440. where:
  4441.  
  4442.    ReqBlockPtr = a FAR pointer to the request block
  4443.  
  4444.    DataSeg = the Protocol Manager's data segment base.
  4445.  
  4446. The Protocol Manager returns in AX the same return code that is
  4447. returned in the ReqBlock "status".
  4448.  
  4449.  
  4450.  
  4451. DOS Calling Convention
  4452. All of the Protocol Manager requests are supported by a single
  4453. DOS IOCTL function.  The services are demultiplexed via a
  4454. function code specified in the ReqBlock.  This IOCTL should be
  4455. requested via Interrupt 21 with general registers loaded with the
  4456. following contents:
  4457.  
  4458. AH = 44H for IOCTL request
  4459. AL = 02H for device input
  4460. DS:DX = Pointer to ReqBlock structure
  4461. CX = 14 for the size of the ReqBlock structure
  4462. BX = Handle from DOS Open of "PROTMAN$"
  4463.  
  4464. This IOCTL generates the following IOCTL request packet
  4465. parameters:
  4466.  
  4467. 1. Block Device Unit Code: Undefined since the Protocol Manager
  4468.    is a character device.
  4469.  
  4470. 2. Command Code: 3 for IOCTL input.
  4471.  
  4472. 3. Status: If the IOCTL corresponds to one of the Protocol
  4473.    Manager commands then the status field is returned with the
  4474.    ERR bit cleared signifying IOCTL successful completion.
  4475.    However the final status of the command is returned in the
  4476.    "status" field of the ReqBlock buffer as defined below.  Note
  4477.    that if the command is recognized the ERR bit is always
  4478.    cleared regardless of the status returned in "status".
  4479.    However if the command is not recognized an IOCTL status
  4480.    UNKNOWN_COMMAND (3) is returned with the ERR bit set.  Finally
  4481.    all of the commands return with the status "DON" bit set.
  4482.  
  4483. 4. Media Descriptor Byte: Unused
  4484.  
  4485. 5. Transfer Address: Pointer to ReqBlock structure.
  4486.  
  4487. 6. Byte/Sector Count: 14
  4488.  
  4489. 7. Starting Sector Number: Unused
  4490.  
  4491. By using the GetProtocolManagerLinkage request a module or
  4492. application may obtain the Protocol Manager dispatch point and
  4493. DS.  It then makes a request to the Protocol Manager via the same
  4494. direct calling mechanism as OS/2.
  4495.  
  4496.  
  4497.  
  4498. Chapter 7:  VECTOR and Dynamic Binding
  4499.  
  4500. In static mode, the VECTOR is a function that is implemented
  4501. within the Protocol Manager that allows more than one protocol
  4502. stack to drive a single MAC.  In this mode, the Protocol Manager
  4503. uses the VECTOR function only if it detects that more than one
  4504. protocol is using the same MAC.  If more that one MAC is attached
  4505. to multiple protocol stacks, then an instantiation of the VECTOR
  4506. is created for each MAC so attached.
  4507.  
  4508. In dynamic mode, the VECTOR function is always present
  4509. unconditionally for protocol/MAC intermodule communications.
  4510. There can be zero, one, or more protocol stacks that bind to a
  4511. MAC, but the VECTOR function is still present.  There can be zero
  4512. protocols if there is only one dynamic protocol stack being used
  4513. in the system and that stack is not currently loaded.  In the
  4514. dynamic mode, the VECTOR shields all static binding MACs from the
  4515. interactions of dynamic binding and unbinding protocol modules.
  4516.  
  4517.  
  4518. Static VECTOR Binding
  4519. The Protocol Manager will modify the normal binding process if it
  4520. detects that multiple protocols have requested the use of the
  4521. same MAC in the PROTOCOL.INI file.
  4522.  
  4523. 1. At INIT time from RegisterModule the Protocol Manager has
  4524.    determined the bind hierarchy and has found some MACs that
  4525.    bind to 2 or more protocols, signaling the insertion of
  4526.    VECTOR.
  4527.  
  4528. 2. To a MAC that will support multiple protocol stacks, the
  4529.    Protocol Manager issues Bind passing a Protocol Manager
  4530.    characteristics table with entry points into the VECTOR
  4531.    module.  The MAC starts itself and returns, passing back to
  4532.    the Protocol Manager a pointer to the MACs characteristic
  4533.    table.
  4534.  
  4535. 3. For a protocol that is part of a multiple protocol stack
  4536.    binding to the single MAC that was issued the previous Bind
  4537.    command, the Protocol Manager issues InitiateBind passing as
  4538.    the bind inter-module entry point, an entry point within the
  4539.    VECTOR module inside of the Protocol Manager.
  4540.  
  4541. 4. The protocol module responds by issuing a Bind request back to
  4542.    the Protocol Manager through its VECTOR entry point.  The
  4543.    protocol module passes its characteristics table to the
  4544.    Protocol Manager VECTOR.  The Protocol Manager returns a
  4545.    characteristics table within the VECTOR which is copied from
  4546.    the associated MAC's characteristics tables, substituting the
  4547.    VECTOR entry points for the real MAC's entry points.
  4548.  
  4549. 5. The protocol starts itself and returns from InitiateBind.
  4550.  
  4551. 6. The Protocol Manager then issues subsequent InitiateBind's to
  4552.    other protocol modules as described above.  If these other
  4553.    protocols are bound to a MAC through the VECTOR, the VECTOR
  4554.    procedure is repeated.  Otherwise the non-VECTOR procedure is
  4555.    used.
  4556.  
  4557. At the conclusion of the binding process the VECTOR is in a
  4558. position to filter calls as appropriate going in either direction
  4559. across the MAC/protocol interface.
  4560.  
  4561.  
  4562. Dynamic VECTOR Binding
  4563. A dynamic protocol module can be loaded and bound after system
  4564. initialization time on a demand basis.  This dynamic loading and
  4565. binding takes place in three phases:
  4566.  
  4567. 1. The PROTOCOL.INI file is re-read.
  4568.  
  4569. 2. The dynamic protocol module does some prebind initialization
  4570.    including getting its PROTOCOL.INI configuration parameters
  4571.    and registering with the Protocol Manager.
  4572.  
  4573. 3. The dynamically loaded protocol module dynamically binds to
  4574.    other modules given in its bind specification.  If these other
  4575.    modules are MAC's, the bind takes place through the Protocol
  4576.    Manager VECTOR facility.
  4577.  
  4578. At some point the dynamic protocol module is no longer required.
  4579. The protocol module unbinds itself, terminates, and unloads
  4580. itself from memory.
  4581.  
  4582. The mechanisms for dynamically binding and unbinding are carried
  4583. out somewhat differently between DOS and OS/2.  The procedures
  4584. are briefly described below.
  4585.  
  4586. Dynamic Binding/Unbinding in the DOS Environment
  4587. 1. In dynamic mode, both static and dynamic protocol modules can
  4588.    be supported.  At startup time, the Protocol Manager performs
  4589.    initialization and binding of static modules as described in
  4590.    section "Static Binding Sequence."  However, in the dynamic
  4591.    mode, the VECTOR function is always inserted.
  4592.  
  4593. 2. At some point after system startup, a dynamic loadable
  4594.    protocol module (that can be a transient application program
  4595.    or a TSR) is demand loaded.  For the dynamic protocol module
  4596.    to have its configuration parameters at initialization, the
  4597.    PROTOCOL.INI file must be re-read.  Either an application
  4598.    program or the protocol module itself reads and parses the
  4599.    PROTOCOL.INI file into the configuration memory image.  It is
  4600.    suggested that the application or protocol module obtain the
  4601.    location of the PROTOCOL.INI file using the "GetProtocolIni"
  4602.    primitive.  A pointer to this memory image is passed to the
  4603.    Protocol Manager via the "RegisterProtocolManagerInfo"
  4604.    primitive.  This is required since the configuration memory
  4605.    image created by the Protocol Manager at INIT time is not
  4606.    valid at  post INIT time.  An application utility,
  4607.    READPRO.EXE, that reads and parses PROTOCOL.INI is provided
  4608.    with the Protocol Manager and is described in Appendix E.
  4609.  
  4610. 3. After loading, the protocol module initializes.  Minimally,
  4611.    the protocol gets its PROTOCOL.INI configuration information
  4612.    from the Protocol Manager via "GetProtocolManager Info," does
  4613.    its prebind initialization, and registers with the Protocol
  4614.    Manager via "RegisterModule."
  4615.  
  4616. 4. Either an application or the dynamic protocol module itself
  4617.    requests that the Protocol Manager initiate the binding
  4618.    sequence via the "BindAndStart" primitive.  This causes the
  4619.    bind sequence described in steps 3 to 5 of the section "Static
  4620.    VECTOR Binding" to be executed.  After the bind, the dynamic
  4621.    protocol is ready for use.  An application utility,
  4622.    NETBIND.EXE, to initiate the binding sequence is provided with
  4623.    the Protocol Manager and is described in Appendix E.
  4624.  
  4625. 5. During operation, all protocol commands to the MAC go through
  4626.    the VECTOR
  4627.  
  4628. 6. When the dynamic protocol module is ready to terminate, either
  4629.    it or an application program issues the "UnbindAndStop"
  4630.    command to the Protocol Manager.  This causes the Protocol
  4631.    Manager to call the protocol's "InitiateUnbind" system entry
  4632.    point.  In turn,  this allows the protocol to issue "Unbinds"
  4633.    to other modules it was bound to and to do final cleanup
  4634.    before terminating.  On return from the "UnbindAndStop"
  4635.    command, the protocol can be removed from memory.  An
  4636.    application utility, UNBIND.EXE, to initiate the unbinding
  4637.    sequence is provided with the Protocol Manager and is
  4638.    described in Appendix E.
  4639.  
  4640. Dynamic Binding/Unbinding in the OS/2 Environment
  4641. 1. In OS/2, all dynamic protocol modules are multi-segment OS/2
  4642.    device drivers.  A dynamic OS/2 protocol differs from a static
  4643.    one in that the dynamic module has code and/or data segments
  4644.    that may be swapped out of virtual memory when not needed.
  4645.    These extra code and data segments must be specified with IOPL
  4646.    in the module's .DEF file so that they are marked as
  4647.    movable/swappable and not discardable by OS/2.  In a static
  4648.    protocol module all segments are permanently locked in memory.
  4649.    A dynamic protocol module uses the OS/2 DevHlp Lock and Unlock
  4650.    calls (using a lock type of 1) to lock and free its code
  4651.    and/or data segments as needed.  A dynamic protocol module is
  4652.    able to re-register multiple times with the Protocol Manager
  4653.    and to dynamically bind with other configured modules.  When
  4654.    no longer required, the dynamic module can unbind and the
  4655.    dynamic memory segments can be Unlock'ed to free up the
  4656.    memory.  Static OS/2 protocol modules register and bind only
  4657.    at system initialization time.  They do not unbind.
  4658.  
  4659. 2. Since all OS/2 dynamic protocol modules are OS/2 device
  4660.    drivers they may perform some INIT time initialization.  The
  4661.    protocol must always register at INIT time with the Protocol
  4662.    Manager via "RegisterModule".  A protocol that is not required
  4663.    at system startup must still register with the Protocol
  4664.    Manager at INIT time passing a NULL BindingsList pointer in
  4665.    the "RegisterModule" primitive.  This is called a non-bindable
  4666.    registration.  In this case the protocol need not lock down
  4667.    its extra code and data segments.  It does, however, need to
  4668.    save the selector values for its dynamic code and data
  4669.    segments.  The device driver's device header, strategy
  4670.    routine, and the NDIS system entry routine must reside in the
  4671.    driver's main code and data segments (the first ones in the
  4672.    driver) which are permanently locked down.  A driver required
  4673.    at system startup must pass a non-NULL BindingsList pointer if
  4674.    it has modules it is required to bind to (a bindable
  4675.    registration).  A driver required at system startup must go
  4676.    ahead and DevHlp Lock its other segments at INIT time, making
  4677.    sure to save the lock handle returned by the call.  Also at
  4678.    INIT time, the protocol module must invoke the
  4679.    "GetProtocolManagerLinkage" primitive to get and save the
  4680.    Protocol Manager's Ring 0 direct entry point and DS.
  4681.  
  4682. 3. Assuming that the protocol was not required at system startup
  4683.    time, at some point in time later it needs to be dynamically
  4684.    bound.  At this point the module needs to get its PROTOCOL.INI
  4685.    configuration parameters, lock down its code and data
  4686.    segments, and perform its bindings.  If the configuration
  4687.    parameters are not retained in the base data segment, the
  4688.    protocol must re-read the PROTOCOL.INI file.  This is done in
  4689.    a similar fashion to that described for DOS.  The
  4690.    "InitAndRegister" primitive is the standard facility that lets
  4691.    the Protocol Manager request the protocol to reload its
  4692.    dynamic segments and perform its prebind initialization.  Upon
  4693.    receiving the "InitAndRegister" primitive, the Protocol
  4694.    Manager calls the protocol driver's system entry point with
  4695.    "InitiatePrebind", allowing the protocol to perform its
  4696.    prebind initialization.  The protocol module uses this
  4697.    opportunity to issue DevHlp Lock calls (lock type 1) on it's
  4698.    dynamic segments to bring them back into memory.  The handle
  4699.    returned from the Lock call must be saved for later unlocking.
  4700.    Also at this juncture, the protocol can get its PROTOCOL.INI
  4701.    memory image from the Protocol Manager via the direct entry
  4702.    point "GetProtocolManagerInfo" function.  It may also do other
  4703.    prebind initialization and finally register with the Protocol
  4704.    Manager via the direct entry point "RegisterModule" function.
  4705.    If the protocol module had previously  made a non-bindable
  4706.    registration at system startup, then the current registration
  4707.    affords it the opportunity to specify its bindings to the
  4708.    Protocol Manager.
  4709.  
  4710. 4. The bind and postbind initialization step is similar to that
  4711.    described for DOS.  Again, any protocol binds to MAC's are
  4712.    performed through the VECTOR.
  4713.  
  4714. 5. During protocol operation, any protocol commands to a MAC go
  4715.    through the VECTOR.
  4716.  
  4717. 6. When the protocol is no longer required, an application or the
  4718.    protocol itself can issue the "UnbindAndStop" command to the
  4719.    Protocol Manager.  The sequence is similar to that described
  4720.    for DOS.  The OS/2 driver, however, issues DevHlp Unlock
  4721.    commands against all of its dynamic segments so that these may
  4722.    be swapped out from memory.  The previously saved Lock handle
  4723.    is required on this call.
  4724.  
  4725.  
  4726. VECTOR Demultiplexing
  4727. The Vector dispatches incoming frames to protocol stacks using
  4728. either a preprogrammed default or user statically defined
  4729. priority polling mechanism.  The default mechanism is based on
  4730. the "Interface Flags" variable in the protocol's lower dispatch
  4731. table.  These flags describe the protocol according to the kinds
  4732. of frames it handles.  Protocols that handle:
  4733.  
  4734. o    Non-LLC frames
  4735. o    LLC frames with specific LSAPs
  4736. o    LLC frames with non-specific LSAPs
  4737.  
  4738. According to default dispatch priority, VECTOR polls protocols in
  4739. that order (and within that order, in the order they registered)
  4740. until it finds one that does not return FRAME_NOT_RECOGNIZED or
  4741. FORWARD_FRAME in the indication.  For specific protocols, this
  4742. default may be overridden by specifying the bracketed name of the
  4743. protocol with the Protocol Manager PROTOCOL.INI keyword PRIORITY.
  4744. Protocols with static priorities specified in this manner are
  4745. polled by the VECTOR before any protocol not  so specified.
  4746. Protocols with static priorities are themselves polled in the
  4747. order in which their bracketed names appear in the PRIORITY
  4748. keyword parameter list.  Of course, a protocol appearing in the
  4749. static list is only polled if it is registered with the Protocol
  4750. Manager and has bound to the MAC offering up the frame.
  4751.  
  4752.  
  4753. Appendix A:  System Return Codes
  4754. This appendix lists return codes used in this version of the NDIS
  4755. specification.  Note that new error codes may be added in the
  4756. future.  Both protocol and MAC driver developers must design
  4757. their code to allow for this.
  4758.  
  4759. 0x0000 SUCCESS:  The function completed successfully.
  4760.  
  4761. 0x0001 WAIT_FOR_RELEASE:  The ReceiveChain completed successfully
  4762. but the protocol has retained control of the data buffer.
  4763. ReceiveRelease will be called to release the data buffers.
  4764.  
  4765. 0x0002 REQUEST_QUEUED:  The current request has been queued.  If
  4766. the request handle is non-zero the module will call
  4767. TransmitConfirm or RequestConfirm when the request completes.
  4768.  
  4769. 0x0003 FRAME_NOT_RECOGNIZED:  Returned from the protocol when a
  4770. MAC does an Indication and the frame does not make sense to the
  4771. protocol.  This will be interpreted by the VECTOR to mean that
  4772. the next protocol in line ought to be called with the Indication.
  4773.  
  4774. 0x0004 FRAME_REJECTED:  A received frame was recognized but it
  4775. was discarded. The buffer may be immediately re-used.
  4776.  
  4777. 0x0005 FORWARD_FRAME:  A protocol wishes the received frame to be
  4778. offered to other protocols but wishes to receive an
  4779. IndicationComplete.  This will be interpreted by the VECTOR to
  4780. mean that the next protocol in line ought to be called with the
  4781. Indication.
  4782.  
  4783. 0x0006 OUT_OF_RESOURCE:  The module is in a transient out of
  4784. resource condition.  The current request was not completed.
  4785.  
  4786. 0x0007 INVALID_PARAMETER:  One or more parameters was invalid.
  4787.  
  4788. 0x0008 INVALID_FUNCTION:  A command function was requested when
  4789. it was not legal to do so or a invalid request was made.
  4790.  
  4791. 0x0009 NOT_SUPPORTED:  A valid request which is not supported by
  4792. the Module was issued.
  4793.  
  4794. 0x000A HARDWARE_ERROR:  A hardware error occurred during the
  4795. execution of this request.  The request was not completed
  4796. successfully and this can be considered non-fatal.
  4797.  
  4798. 0x000B TRANSMIT_ERROR:  The packet was not transmitted.  May
  4799. indicate a local resource problem, excessive collisions, or a
  4800. remote resource problem.  On Token Ring networks, this would be
  4801. returned if the destination address was recognized but the
  4802. receiver was out of buffers.  This is a non-fatal error and can
  4803. be taken as a hint that the packet should be retransmitted.
  4804.  
  4805. 0x000C NO_SUCH_DESTINATION:  The destination address was not
  4806. recognized by any adapter on the local ring.  This error is Token
  4807. Ring specific and can be interpreted to mean that source routing
  4808. must be invoked to reach the destination.
  4809.  
  4810. 0x000D BUFFER_TOO_SMALL: The buffer provided was too small for
  4811. the information being returned.  Some commands may still return
  4812. partial information.
  4813.  
  4814. 0x0020 ALREADY_STARTED:  The Protocol Manager has already started
  4815. the network drivers.  This error occurs when BindAndStart is
  4816. called more than once.
  4817.  
  4818. 0x0021 INCOMPLETE_BINDING:  This bind-time error occurs when the
  4819. Protocol cannot complete all of the bindings described in the
  4820. bindings list, most probably due to missing modules.
  4821.  
  4822. 0x0022 DRIVER_NOT_INITIALIZED:  This bind-time error occurs when
  4823. the MAC does not initialize properly during system boot, and a
  4824. subsequent request is made to the MAC.
  4825.  
  4826. 0x0023 HARDWARE_NOT_FOUND:  This bind-time error occurs when the
  4827. network adapter is not found by the MAC.
  4828.  
  4829. 0x0024 HARDWARE_FAILURE:  This bind-time error occurs in the
  4830. following cases: network adapter reset failed, network adapter
  4831. diagnostics failed, network adapter is not responding, network
  4832. adapter is not found by the MAC. This error can be considered fatal.
  4833.  
  4834. 0x0025 CONFIGURATION_FAILURE:  This bind-time error occurs when
  4835. the configuration is unacceptable to the network adapter.
  4836.  
  4837. 0x0026 INTERRUPT_CONFLICT:  This bind-time error occurs in OS/2
  4838. only, when an interrupt from some other device in the computer
  4839. conflicts with the network adapter's.
  4840.  
  4841. 0x0027 INCOMPATIBLE_MAC:  This bind-time error occurs when a
  4842. Protocol determines a MAC is not compatible for the binding
  4843. operation.  Thus, binding cannot proceed.
  4844.  
  4845. 0x0028 INITIALIZATION_FAILED:  This bind-time error occurs when a
  4846. Protocol fails its initialization.
  4847.  
  4848. 0x0029 NO_BINDING:  This bind-time error occurs to indicate that
  4849. the binding was not performed.  This error can occur if a
  4850. protocol driver took an error exit during its initialization or
  4851. if a protocol driver has its upper level incorrectly specified as
  4852. a MAC.
  4853.  
  4854. 0x002A NETWORK_MAY_NOT_BE_CONNECTED:  This bind-time error
  4855. indicates that the adapter may not be connected to a network.
  4856. Intended to be suggestive of corrective action by the user.
  4857.  
  4858. 0x002B INCOMPATIBLE_OS_VERSION:  This bind-time error indicates
  4859. that a protocol or MAC driver does not support the version of DOS
  4860. or OS/2 being used.
  4861.  
  4862. 0x002C ALREADY_REGISTERED:  This error is returned by the
  4863. Protocol Manager if an attempt is made to register a module with
  4864. a module name already registered with the Protocol Manager.  It
  4865. is also returned from a "RegisterStatus" primitive to indicate
  4866. that the name is already registered.
  4867.  
  4868. 0x002D PATH_NOT_FOUND:  This error is returned by the DOS
  4869. Protocol Manager if PROTMAN.EXE could not be found when
  4870. attempting to execute a BindAndStart or UnBindAndStop command.
  4871.  
  4872. 0x002E  INSUFFICIENT_MEMORY:  This error is returned by the DOS
  4873. Protocol Manager if PROTMAN.EXE could not be loaded due to
  4874. insufficient DOS memory when attempting to execute a BindAndStart
  4875. or UnbindAndStop command.
  4876.  
  4877. 0x002F INFO_N0T_FOUND:  This error is returned by the DOS
  4878. Protocol Manager in a GetProtocolManagerInfo command if the
  4879. PROTOCOL.INI structured configuration memory image is not present
  4880. or previously invalidated due to being overwritten or corrupted.
  4881.  
  4882. 0x00FF GENERAL_FAILURE:  Unspecified failure during execution of
  4883. the function
  4884.  
  4885. 0xF000 - 0xFFFF:  Reserved for vendor defined error returns.
  4886. These errors are treated as GENERAL_FAILURE.
  4887.  
  4888.  
  4889. Appendix B:  Reference Material
  4890.  
  4891. OS/2 Device Drivers Guide
  4892.  
  4893. DOS Technical Reference
  4894.  
  4895. ANSI/IEEE standard 802.2 - 1985 (ISO/DIS 8802/2) Logical link
  4896. control standard.
  4897.  
  4898. ANSI/IEEE standard 802.5 - 1985 (ISO/DIS 8802/5) Token ring local
  4899. area network standard.
  4900.  
  4901. ANSI/IEEE standard 802.3 - 1985 (ISO/DIS 8802/3) Carrier Sense
  4902. Multiple Access with Collision Detection local area network
  4903. standard.
  4904.  
  4905. The Ethernet. A Local Area Network. Data Link Layer and Physical
  4906. Layer Specifications, V2.0, November 1982.  Also known as the
  4907. "Ethernet Blue Book"
  4908.  
  4909. IBM Token Ring Network PC Adapter Technical Reference (69X7830)
  4910.  
  4911. IBM Token Ring Network Architecture Reference - November 1985
  4912. (6165877)
  4913.  
  4914. Information processing systems - Open Systems Interconnection -
  4915. Basic Reference Model, (ISO 7498) The OSI reference model.
  4916.  
  4917.  
  4918.  
  4919. Appendix C:  802.3 Media Specific Statistics
  4920.  
  4921. The 802.3 media specific statistics structure is defined as
  4922. follows:
  4923.  
  4924.        Statistics in bold are manditory, all others are strongly
  4925.        recommended.
  4926.        Reserved slots should return as 0xFFFFFFFF (unsupported).
  4927.  
  4928. WORD       Length of 802.3 Statistics structure, including this field
  4929. WORD       802.3 Statistics structure version level (1)
  4930. DWORD      Frames with alignment error
  4931. DWORD      Reserved (Obsolete statistic)
  4932. DWORD      Total frames with overrun error
  4933. DWORD      Reserved (Obsolete statistic)
  4934. DWORD      Total frames transmitted after deferring
  4935. DWORD      Total frames not transmitted - max (16) collisions
  4936. DWORD      Reserved (Obsolete statistic)
  4937. DWORD      Total late (out of window) collisions
  4938. DWORD      Total frames transmitted after exactly 1 collision
  4939. DWORD      Total frames transmitted after multiple collisions
  4940. DWORD      Total frames transmitted, CD heartbeat
  4941. DWORD      Reserved (Obsolete statistic)
  4942. DWORD      Total carrier sense lost during transmission
  4943. DWORD      Reserved (Obsolete statistic)
  4944. DWORD      Total number of underruns (V2.0.1 and later)
  4945.  
  4946. When updating the statistics counters, a frame is counted in all
  4947. the supported counters that apply.
  4948.  
  4949. Examples:
  4950.  
  4951. (a)   A 'Multicast frame received ok's is counted in the following
  4952.       statistics counters:
  4953. .     Total multicast frames received ok
  4954. .     Total frames received ok
  4955.  
  4956. (b)   A 'Transmit Broadcast frame with one collision' is counted in
  4957.       all the following statistics counters:
  4958. .     Frames transmitted with only one collision.
  4959. .     Total broadcast frames transmitted.
  4960. .     Total frames transmitted ok.
  4961.  
  4962.  
  4963. MEDIA SPECIFIC STATISTICS DEFINITIONS:
  4964.  
  4965. Frames received with alignment error
  4966. (NumberOfFramesReceivedWithAlignmentErrors)
  4967.       
  4968.       This contains a count of frames that are not an integral 
  4969.       number of bytes in length and do not pass FCS check. 
  4970.       Reports on alignments errors "as the station sees it".
  4971.  
  4972. Frames received with overrun errors
  4973.       
  4974.       This contains a count of frames which could not be 
  4975.       accepted due to a DMA overrun error.
  4976.  
  4977. Frames transmitted after deferring
  4978. (NumberOfFramesWithDeferredTransmission)
  4979.       
  4980.       This counter does not include frames involved in collisions.
  4981.  
  4982. Frames not transmitted - max collisions execeeded.
  4983. (NumberOfFramesAbortedDueToExcessiveCollision)
  4984.       
  4985.       This contains a count of the frames that are not transmitted 
  4986.       successfully due to excessive collisions.
  4987.  
  4988. Frames transmitted with late (out-of-window) collision.
  4989. (NumberOfLateCollisions)
  4990.       
  4991.       This contains a count of frames that are involved in a 
  4992.       out-of-window collision.
  4993.  
  4994. Frames transmitted after exactly one collision
  4995. (NumberOfSingleCollisionFrames)
  4996.       
  4997.       This contains a count of frames that are transmitted
  4998.       after exactly one collision.
  4999.  
  5000. Frames transmitted after multiple collisions
  5001. (NumberOfMultipleCollsionFrames)
  5002.       
  5003.       This contains a count of frames that are transmitted
  5004.       after multiple number of collisions.
  5005.  
  5006. Frames transmitted, CD heartbeat
  5007. (NumberOfSQETestErrors)
  5008.       
  5009.       This contains a count of frames transmitted with CD(collision
  5010.       detection) signal missing.
  5011.  
  5012. Frames with carrier sense lost during transmission
  5013. (NumberOfCarrierSenseErrors)
  5014.       
  5015.       This contains a count of frames that experienced carrier sense
  5016.       lost (carrier sense signal not present at the receive pair of the
  5017.       controller) during transmission.
  5018.  
  5019. Frames transmitted with underrun error (V2.0.1 and later)
  5020.       
  5021.       This contains a count of frames which could not be transmitted 
  5022.       due to a DMA underrun error.
  5023.    
  5024.     
  5025.  
  5026. Appendix D:  802.5 Media Specific Statistics
  5027.  
  5028. MEDIA SPECIFIC STATISTICS TABLE STRUCTURE:
  5029.  
  5030. The 802.5 media specific statistics structure is defined as
  5031. follows:
  5032.  
  5033.       Statistics in bold are mandatory, all others are strongly
  5034.       recommended. 
  5035.       Reserved slots should return as 0xFFFFFFFF (unsupported)
  5036.           
  5037. WORD       Length of 802.5 Statistics structure, including this field
  5038. WORD       802.5 Statistics structure version level (1)
  5039. DWORD      FCS or code violations detected in repeated frame
  5040. DWORD      Reserved (Obsolete statistic)
  5041. DWORD      Number of 5 half-bit time transition absences detected
  5042. DWORD      A/C errors
  5043. DWORD      Frames transmitted with abort delimiter
  5044. DWORD      Frames transmitted that failed to return
  5045. DWORD      Frames recognized, no buffer available
  5046. DWORD      Frame copied errors
  5047. DWORD      Number of frequency errors detected
  5048. DWORD      Number of times active monitor regenerated
  5049. DWORD      Reserved
  5050. DWORD      Reserved
  5051. DWORD      Reserved
  5052. DWORD      Reserved (Obsolete statistic)
  5053. DWORD      Number of underruns
  5054.  
  5055. When updating the statistics counters, a frame is counted in
  5056. all the supported counters that apply.
  5057.  
  5058. MEDIA SPECIFIC STATISTICS DEFINITIONS:
  5059.  
  5060. FCS or code violations detected in repeated frame
  5061.  
  5062.       This counter is incremented for every repeated frame that has 
  5063.       a code violation or fails the Frame Check Sequence (FCS)
  5064.       cyclic redundancy check.
  5065.  
  5066. Number of 5 half-bit time transition absences detected
  5067.  
  5068.      Also known as Burst Error, this counter is incremented 
  5069.      every time 5 half-bit time transitions are not detected
  5070.      between SDEL and EDEL in repeated frame.
  5071.  
  5072. A/C errors
  5073.  
  5074.      Also known as ARI/FCI set error, this counter is incremented
  5075.      when a station receives more than one AMP or SMP MAC frames with
  5076.      AC (ARI/FCI) equal to zero without first receiving an intervening
  5077.      AMP MAC frame. This counter indicates that the upstream Adapter is 
  5078.      unable to set its AC (ARI/FCI) bits in a frame that it has copied.
  5079.  
  5080. Frames transmitted with abort delimiter
  5081.       
  5082.       This counter is incremented each time the Adapter transmits
  5083.       an abort delimiter. This indicates that the frame was aborted
  5084.       in mid-transmission.
  5085.  
  5086. Frames transmitted that failed to return
  5087.      
  5088.       This counter is incremented when a transmitted frame fails to
  5089.       return from around the ring due to time-out or the reception of 
  5090.       another frame.
  5091.  
  5092. Frames recognized, no buffer available
  5093.   
  5094.       Also known as Receiver congestion, this counter is incremented
  5095.       when a ring station is receiving/repeating a frame and recognizes
  5096.       a frame addressed to it, but has no buffer space available for 
  5097.       the frame.
  5098.  
  5099. Frame copied errors
  5100.   
  5101.       This counter is incremented when a ring station receives or
  5102.       repeats a frame from the ring with the ring stations's 
  5103.       individual address, but with A = C = 1, indicating a possible
  5104.       duplicate address.
  5105.  
  5106. Number of frequency errors detected
  5107.  
  5108.       This counter is incremented when a ring stations detects a
  5109.       signal frequency problem.
  5110.  
  5111. Number of times active monitor regenerated
  5112.     
  5113.       This counter is incremented each time the active monitor
  5114.       is lost and regenerated.
  5115.  
  5116. Number of underruns
  5117.  
  5118.       This counter is incremented each time a DMA underrun is detected.
  5119.  
  5120.  
  5121. Appendix E:  Utilities Provided with the Protocol Manager
  5122.  
  5123. To save system integrators the effort to read and parse the
  5124. PROTOCOL.INI file, to register it with the Protocol Manager, to
  5125. invoke the binding and unbinding Protocol Manager primitives, and
  5126. to report various Protocol Manager error conditions, 3 utilities
  5127. are provided with the Protocol Manager in both the DOS and OS/2
  5128. environments and one utility is provided exclusively for the OS/2
  5129. environment:
  5130.  
  5131. 1.  NETBIND.EXE - Initiates the binding and operational
  5132.                   startup of a set of modules previously loaded.
  5133.                   It issues to the Protocol Manager the
  5134.                   BindAndStart primitive and reports to the console
  5135.                   any binding/initialization errors detected by the
  5136.                   modules bound.  This utility can be used in
  5137.                   either the static or dynamic Protocol Manager
  5138.                   modes of operation.  In the static mode it should
  5139.                   be invoked after all device driver modules are
  5140.                   loaded (e.g. from AUTOEXEC.BAT in DOS or
  5141.                   STARTUP.CMD in OS/2).  In the dynamic mode it can
  5142.                   be invoked either at system startup time as in
  5143.                   static mode or after a set of dynamically
  5144.                   loadable modules have been loaded and are ready
  5145.                   to be run.  There are no command line parameters
  5146.                   associated with this utility.
  5147.  
  5148. 2. UNBIND.EXE -    Initiates the unbinding and termination
  5149.                    sequence of a set of dynamically loadable modules
  5150.                    previously loaded and bound.  It issues to the
  5151.                    Protocol Manager the UnbindAndStop primitive and
  5152.                    reports to the console any unbinding/termination
  5153.                    errors detected by the modules being unbound.
  5154.                    The utility can be used only in the dynamic
  5155.                    Protocol Manager mode of operation.  Invocation
  5156.                    in the static mode will generate an error.  It
  5157.                    should be invoked when it is desired to terminate
  5158.                    (and release from memory) a set of dynamically
  5159.                    loadable modules that have been previously loaded
  5160.                    and bound.  In DOS each invocation will terminate
  5161.                    and unbind the last set of modules previously
  5162.                    bound via the NETBIND.EXE utility.  Modules can
  5163.                    be bound and unbound in groups if required by
  5164.                    invoking NETBIND.EXE for each group of modules to
  5165.                    be bound together and later invoking UNBIND.EXE.
  5166.                    UNBIND.EXE  will unbind the groups only in the
  5167.                    reverse order in which the groups were
  5168.                    previsoulsy bound.  If protocols are implemented
  5169.                    so that they free themsleves from memory at the
  5170.                    end of the unbind sequence, then this utility
  5171.                    will free up the memory of all such protocols
  5172.                    unbound.  This utility has no effect on MAC
  5173.                    drivers which are always static device drivers.
  5174.                    In OS/2 the utility takes an argument string
  5175.                    specifying the name of the module being unbound.
  5176.                    In DOS there are no command line parameters
  5177.                    associated with this utility.
  5178.  
  5179. 3.  READPRO.EXE -  Reads the PROTOCOL.INI file, parses it into
  5180.                    a memory image and registers this memory image
  5181.                    with the Protocol Manager so that the image is
  5182.                    available to dynamically loadable protocols when
  5183.                    they request their configuration memory image
  5184.                    information.  By invoking the GetProtocolIniPath
  5185.                    Protocol Manager primitive, this utility assures 
  5186.                    that the PROTOCOL.INI file is read from the
  5187.                    same subdirectory as that used by the Protocol
  5188.                    Manager when it had initialized.  The memory
  5189.                    image is registered with the Protocol Manager via
  5190.                    the RegisterProtocolManagerInfo primitive.  This
  5191.                    utility can be used only in the Protocol Manager
  5192.                    dynamic mode of operation.  The utility reports
  5193.                    any detected error condtions on the console.  It
  5194.                    should be invoked prior to the loading of any
  5195.                    dynamic modules.  There are no command line
  5196.                    parameters associated with this utility.
  5197.  
  5198. 4.  RELOAD.EXE.-   Initiates the prebind initialization of
  5199.                    an OS/2 dynamically loadable module.  It issues
  5200.                    to the Protocol Manager the InitAndRegister
  5201.                    primitive containing the module name that was
  5202.                    given as a command line parameter.  The Protocol
  5203.                    Manager calls the system entry point of the named
  5204.                    module with the InitiatePrebind system function.
  5205.                    The modules is required to reinitialize, which
  5206.                    may include locking down swappable segments,
  5207.                    requesting and parsing the PROTOCOL.INI image,
  5208.                    and reregistering with the Protocol Manager in
  5209.                    preparation for a subsequent NETBIND.EXE
  5210.                    invocation.  This utility reports any detected
  5211.                    error to the console.  It applies only to OS/2.
  5212.  
  5213. If the system integrator requires more functionality than that
  5214. provided by these utilities, the integrator can write an
  5215. application utility directly that performs the desired
  5216. functionality and invokes the required Protocol Manager
  5217. primitives described in Chapter 5.  For example if in DOS a more
  5218. flexible unbind facility to unbind in a user specified order is
  5219. required, UNBIND.EXE can be replaced by a user written utility
  5220. that invokes the UnbindAndStop primitive in which Pointer2 points
  5221. to the name of the module to be unbound.
  5222.  
  5223.  
  5224.